Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: UPDATE problem

  1. #1
    New Coder
    Join Date
    Jul 2002
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    UPDATE problem

    I cannot figure out what is wrong with this code. Please help

    $q = "UPDATE profiles SET label = '$label', email = '$email', show_email = '$se', bio = '$bio', show = '$show' WHERE id = '$id'";
    mysql_query($q) or die("What's wrong with this thing!?");

  • #2
    Supreme Overlord Spookster's Avatar
    Join Date
    May 2002
    Location
    Marion, IA USA
    Posts
    6,278
    Thanks
    4
    Thanked 83 Times in 82 Posts
    Is there an error? What's not working?
    Spookster
    CodingForums Supreme Overlord
    All Hail Spookster

  • #3
    New Coder
    Join Date
    Jul 2002
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    it works except for the show = '$show'

    is that some kind of keyword or something?

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    So you mean that the value in $show does not appear in the 'show' field for the updated row? If so, what value did $show have before you inserted it into your query string?

    Usually it helps for debugging to assign the whole query string to a variable and print that to see what the query really looked like.

  • #5
    New Coder
    Join Date
    Jul 2002
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I changed show to show_p in my table and it works. It seems show is some kind of keyword or something?

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    577
    Thanks
    0
    Thanked 0 Times in 0 Posts
    show is a syntax that mysql can use - used for outputting information on the table/database. Though, so saying that, I'm a tad surprised that a field cannot be named it. If that were the case you wouldn't be able to name a field 'delete' and I'm pretty sure that I have before.

    SHOW syntax in the manual
    Ökii - formerly pootergeist
    teckis - take your time and it'll save you time.

  • #7
    New Coder
    Join Date
    Aug 2002
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Have a look here, this is the list of reserved words used by MySQL. Show and Delete are in fact there:

    http://www.mysql.com/documentation/m...Reserved_words


  •  

    Posting Permissions

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