SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Thread: Boo Hoo

  1. #1
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Boo Hoo



    mysql_query("UPDATE list SET writeup='$writeup' email='$email' logo='$logo' WHERE id='$id'")
    or die("Nooooooo!!!");



    Im running this and im getting NOOOOOOOOO!!!!
    make the no stop!!!!!!
    all the variables are beng passed through and they are all valid fields in the database... there has to be something wrong with the syntax.. I dont see it though

  2. #2
    SitePoint Evangelist CyberFuture's Avatar
    Join Date
    May 2001
    Location
    San Diego, CA
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You're missing the comma's. Try this:

    mysql_query("UPDATE list SET
    writeup='$writeup', email='$email', logo='$logo' WHERE id='$id'")
    or die("Nooooooo!!!" . mysql_error());

  3. #3
    SitePoint Zealot zook's Avatar
    Join Date
    May 2001
    Location
    Houston, tx
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    does that take the column (field) values from your database table and insert them into the variables...like taking the field the 'writeup' or 'email' from whatever ID is given to the script, and inserting it into '$writeup' or '$email'?

    I posted a question on how to do that earlier, but I didn't really get an answer.

  4. #4
    SitePoint Guru
    Join Date
    Apr 2001
    Location
    BC, Canada
    Posts
    630
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    2 things... first of all to cyberfuture...that didnt work

    second.. yes that is kind of what it is doing. But the fields are called writeup and email, and the values being put into them are whats stored in the variables $writeup and $email

  5. #5
    SitePoint Zealot zook's Avatar
    Join Date
    May 2001
    Location
    Houston, tx
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    would you happen to know how to take values from database table fields and place them into variables?

  6. #6
    Node mutilating coot timnz's Avatar
    Join Date
    Feb 2001
    Location
    New Zealand
    Posts
    516
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    zook, I think you would be wanting the SELECT statement rather than the update statement. The update statement updates the database, whereas the select statement selects fields from the database.

    You would be looking for something like this:

    $sql = mysql_query("SELECT * FROM tablename WHERE....");
    $result = mysql_fetch_array($sql);
    and then you would assign the fields to different variables like so:
    $variable = $result["columnname"];

    or you could use
    extract ($result);

    which will extract the $result and assign each column data to a variable by the name of the column.

    If I had a column named content, using extract ($result); I would get that column as the $content.

  7. #7
    SitePoint Evangelist CyberFuture's Avatar
    Join Date
    May 2001
    Location
    San Diego, CA
    Posts
    434
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    SlightlyWacked,

    What was the error message you got when the revised query failed.

  8. #8
    SitePoint Zealot zook's Avatar
    Join Date
    May 2001
    Location
    Houston, tx
    Posts
    134
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the info timnz.


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
  •