Php error: YouhaveanerrorinyourSQLsyntax; urgent !!!!! $ SQL = & quot; selectid, title, type_id, timefromnewslimit $ offset, $ Page_si php error: You have an error in your SQL syntax; urgent !!!!!
$ SQL = "select id, title, type_id, time from news limit $ offset, $ Page_size where type_id =". $ type_id;
Echo $ SQL;
$ Result = mysql_query ($ SQL) or die ($ SQL ."
". Mysql_error ());;
While ($ row = mysql_fetch_array ($ result ))
{
?>
"> Modify and delete
Go directly to the code !!!!! Error message: 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 ''0, 6 'Where type_id = 21' at line 1
What is going on ?????????????????? Urgent !!!!!!!!!!!!!!!!!!
------ Solution --------------------
Select id, title, type_id, time from news limit $ offset, $ Page_size where type_id = ". $ type_id;
Modify
Select id, title, type_id, time from news where type_id = ". $ type_id." order by id desc limit {$ offset}, {$ Page_size }";
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service