PHP MySQL Syntax Error 'You have an error in your SQL syntax'
- by Alec
I cannot figure out the issue with my code here. I am trying to take info from the table, then subtract 1 second from Current_Time which looks like '2:00'. The problem is, I get:
"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 'Current_Time) VALUES('22')' at line 1"
I don't even understand where it gets 22 from.
Thanks, I really appreciate it.
if (isset($_GET['id']) && isset($_GET['time'])) {
mysql_select_db("aleckaza_pennyauction", $connection);
$query = "SELECT Current_Time FROM Live_Auctions WHERE ID='1'";
$results = mysql_query($query) or die(mysql_error());
while ($row = mysql_fetch_array($results)) {
$newTime = $row['Current_Time'] - 1;
$query = "INSERT INTO Live_Auctions(Current_Time) VALUES('".$newTime."')";
$results = mysql_query($query) or die(mysql_error());
}
}