SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: lost id value?!

  1. #1
    blonde.... Sarah's Avatar
    Join Date
    Jul 2001
    Location
    Berkshire, UK
    Posts
    7,442
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    lost id value?!

    I have many forms which are linked together and they insert various information into different tables in my database, the problem I have is when I want to update the information in a table using the following command

    $sql = "UPDATE technical SET q3='$Q3', q4='$Q4' where id=$did

    an error comes up saying unknown variable did BUT I have brought did from the last page using....

    $did = mysql_insert_id();
    header("Location: detail2.php?did='$did'");


    If I change the first line to id=10 then the update statement works but for some reason I am losing the did value when trying to update...?

    Any help on this would be great

    Thanks in advance

    Sarah

  2. #2
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi there, try losing the single quotes, i.e

    from
    header("Location: detail2.php?did='$did'");
    to
    header("Location: detail2.php?did=$did");

    if still no go then add single quotes to your query..

    ....Q4' where id='$did'


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •