04-10-2008, 09:46 AM
|
#1 (permalink)
|
|
The Wanderer
Join Date: Apr 2008
Posts: 12
Thanks: 7
|
Keep getting mySQL error No. 1064, but i can't seem to find the problem
Hello all, i keep geeting the 1064 mySQL error from an sql statement, yet the statement looks valid all the way through.
Here is the PHP script that should update the DB:
PHP Code:
function update($sql, $date){
$link = aaa_connect();
$sql2 = str_replace("\n", "", $sql);
$sql2 = str_replace("\'", "'", $sql2);
$result = mysql_query($sql2, $link);
if(!$result){die('Invalid query: '.mysql_error().'<br>Error No: '.mysql_errno());}
$array[0] = mysql_affected_rows();
$array[1] = date('l',mktime(0,0,0,substr($date, 6, 2),substr($date, 9,2),substr($date,1,4))).' the '.date('j',mktime(0,0,0,substr($date, 6, 2),substr($date, 9,2),substr($date,1,4))).'. of '.date('F',mktime(0,0,0,substr($date, 6, 2),substr($date, 9,2),substr($date,1,4))).' '.date('Y',mktime(0,0,0,substr($date, 6, 2),substr($date, 9,2),substr($date,1,4)));
mysql_close($link);
return $array;
}
and here is the sql statement being given to the function:
Code:
UPDATE aaa_gallery SET date = '2008-04-10' WHERE hash = '7300ba4b247142ae68edc24029638129';
UPDATE aaa_gallery SET date = '2008-04-10' WHERE hash = '132f0d58ef38cd0cd91b56334b702efd';
UPDATE aaa_gallery SET date = '2008-04-10' WHERE hash = '19934c1a89b47724c1e7efe97dd84fcd';
UPDATE aaa_gallery SET date = '2008-04-10' WHERE hash = '3eecd1bf00faa7ebb3ca74bf9fbe379a';
i keep getting this error message back:
Code:
Invalid query: 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 '; UPDATE aaa_gallery SET date = '2008-04-10' WHERE hash = '132f0d58ef38cd0cd91b5' at line 1
Error No: 1064
Can anyone help me out with this one?
Last edited by Durux : 04-10-2008 at 10:11 AM.
|
|
|
|