SQL error while using mysql_query() but not in PHPMyAdmin
I get the following 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
My query is:
SELECT * FROM `history` LIMIT 0 , 30
When I run it in PHPMyAdmin it works fine, and the database con开发者_开发技巧nection is working.
EDIT: Okay this is solved. My FTP client was saying it was copying the file to the server but when I tried to open the file in cpanle's file manager it was corrupted.
Try using "real" single quotes or leave them out altogether in PHP instead of the "tilted" ones that PhpMyAdmin gives you.
$query = "SELECT * FROM history LIMIT 0, 30";
should work.
Make sure you type your own ', if you copy the query from phpmyadmin the apostrophies are different then the ones you type, like this 'history'
精彩评论