SA-MP Forums Archive
MySql query?! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: MySql query?! (/showthread.php?tid=455626)



MySql query?! - iJumbo - 02.08.2013

Whats wrong with that PHP mysql query?


PHP код:
mysql_query("UPDATE TB_233 SET PR = '".$nn."' WHERE PR = '".$vn."'") or die(mysql_error()); 
Returns the follow 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 'TB_233 SET PR = 'Test' WHERE PR = 'testminusone'' at line 1



Re: MySql query?! - SchurmanCQC - 02.08.2013

I couldn't figure out any problems with that query, but here's some cleaner code I suggest you use.

PHP код:
mysql_query("UPDATE `TB_233` SET `PR` = '$nn' WHERE `PR` = '$vn'") or die(mysql_error()); 
My suggestions are to make sure that TB_233 and the PR column exist, and you are connected to the correct database.

I also HIGHLY suggest you convert to MySQLi. The old PHP_MySQL is deprecated and could cause severe compatibility problems with webhosts and servers using newer or older versions of PHP.


Re: MySql query?! - iJumbo - 02.08.2013

I know, im testing on a old server..

The query seems fine but i still get errors

EDIT:

Seems working now with my code and your code.
BTW thanks for help but i didn't get out of that weird problem

+rep for you..