Dynadot โ€” .com Transfer

SQL syntax Error on UPDATE query

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.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
heh... i always post problems and then figure them out straight away! lol
 
0
•••
Appraise.net
Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
DomainEasy โ€” Payment Flexibility
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back