Tag Archives: for the right syntax to use near ”X”

[How to Solve] for the right syntax to use near ”X”

BUG:

Error Number: 1064

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 ”4” at line 1

SELECT a.*,b.user_nickname, b.user_head_url from qk_user_album a, qk_user b where a.album_user_id = b.user_id ORDER BY a.album_create_date desc LIMIT 0, ‘4’;

Filename: D:\DEV_PHP\WAMP\www\qk\system\database\DB_driver.php

Line Number: 330

 

Problem solved.

Here the limit syntax is used, the two parameters should be numbers, should not appear string

The reason is that when PHP pass the parameters, the second parameter is not converted, add an intval function, string to number can be