[php][mysql] UPDATE function

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by taekwondokid42, Feb 23, 2008.

  1. taekwondokid42

    taekwondokid42 New Member

    Messages:
    268
    Likes Received:
    0
    Trophy Points:
    0
    mysql_query("UPDATE wiki_quotes SET Quote = '$Quote' WHERE id = \"$counter\"");


    That line of code is a working line of code.

    I need to set a column named Submitted By equal to another variable.

    If I try...

    ...SET 'Submitted By' it gives me an error becuase of the 's

    ...SET Submitted By it gives me an error becuase of the space

    ...SET \"Submitted By\" it gives me an error because of the quotes.



    Does anyone have any other suggestions?
     
  2. Bryon

    Bryon I Fix Things

    Messages:
    8,149
    Likes Received:
    101
    Trophy Points:
    48
    ("UPDATE `wiki_quotes` SET `Quote` = '$Quote', `Submitted By` = '$submittedBy' WHERE `id` = '$counter'");
     
  3. taekwondokid42

    taekwondokid42 New Member

    Messages:
    268
    Likes Received:
    0
    Trophy Points:
    0
    I'm not quite sure why that worked, but thank you.
     
  4. Adam01

    Adam01 New Member

    Messages:
    114
    Likes Received:
    0
    Trophy Points:
    0
    You can use ` aswell as '.
     
    Last edited: Feb 24, 2008

Share This Page