NameSilo

SQL syntax Error on UPDATE query

SpaceshipSpaceship
SpaceshipSpaceship
SpaceshipSpaceship
Watch

TwiztedFake

Established Member
Impact
1
The error is:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '(date, time, uname, subject, content) VALUES ('10-20-2006', '6:

My code is:
PHP:
$sql = "UPDATE ct_news SET (date, time, uname, subject, content) VALUES ('$date', '$time', '$uname', '$subject', '$content') WHERE ID='$id' LIMIT 1";
$result = mysql_query($sql);

How did I write this so that it updates the table row with the new data.

**UPDATE**
Geez. . . 2nd problem I've posted this week that I got figured out within 10 minutes of posting it.

Changed the $sql= line to:
PHP:
$sql = "UPDATE ct_news SET date = '$date', time = '$time', uname = '$uname', subject = '$subject', content = '$content' WHERE ID = '$id' LIMIT 1";

Now it works! I tried that once but I guess I most have had something in the wrong place.
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
heh... i always post problems and then figure them out straight away! lol
 
0
•••
Appraise.net

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover

NamePros updates

New in Parking: updated way to act on many domains or inquiries at once
Your domain list and inquiry list now have a bar above and below the list. Check the items you want, then choose an action in the bar...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back