but I'm not seeing the syntax error.
help anybody?
$result=mysql_query("UPDATE Stores SET Store='$store', Email='$email', Address='$address', Phone='$phone', Manager='$manager' WHERE id='$store_id'") or die(mysql_error());
10-24-2012, 03:50 PM
NoEffinWay
What does the error say?
10-24-2012, 03:51 PM
A123Schmidt
MySQL Error: 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 '1' at line 1
1
10-24-2012, 03:53 PM
NoEffinWay
Is one the value of '$store_id'? If so, try this: $result=mysql_query("UPDATE Stores SET Store='$store', Email='$email', Address='$address', Phone='$phone', Manager='$manager' WHERE id=$store_id") or die(mysql_error());
10-24-2012, 03:56 PM
A123Schmidt
$store_id is the id column in the MySQL database, and I'm trying to edit a row
this the error that I'm getting now
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 '' at line 1
Ok, well revert to you query.
$store_id = $_GET['id'];
Nothing is being passed via GET, it is all POST data
So it should be:
$store_id = $_POST['id'];
10-24-2012, 04:04 PM
A123Schmidt
still not working
getting this error
MySQL Error: 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 '1' at line 1
1
10-24-2012, 06:12 PM
NoEffinWay
Not that you fixed the GET thing, try my query. I think it is having issues because you are comparing an integer to a string.
10-24-2012, 08:10 PM
NogDog
A bit of a style thingy that can make it easier to locate the error:
Since I don't see you using mysql_real_escape_string() anywhere, my best guess without seeing the results of that error output is some unescaped special character in one of the variables being used in the query. In any case, I'd strongly recommend moving up to the MySQLi extension or even the PDO extension and make use of prepared statements and bound parameters, and let PHP handle any escaping that's needed itself.