An error is reported for MYSQL variables in PHP. $ SQL = 'set @ rank = 0; & nbsp ;. 'select * FROM (SELECT @ rank: = @ rank + 1 ASrank, yb2000_event_phone, and yb2000_e report an error to the MYSQL variable in PHP.
$ SQL = 'set @ rank = 0;
. 'Select * FROM (SELECT @ rank: = @ rank + 1 AS rank, yb2000_event_phone, yb2000_event_point FROM yb2000_event WHERE yb2000_event_riqi = \ '2017-07 \ 'group BY yb2000_event_phone order by yb2000_event_point DESC) a WHERE. yb2000_event_phone = \ '2017 \'';
When PHPMYADMIN runs normally in PHP, the following error occurs: Warning: mysql_fetch_assoc (): supplied argument is not a valid MySQL result resource to delete SET @ rank = 0; this paragraph is normal again-a bit of expert advice
------ Solution --------------------
Mysql_query can only execute one SQL statement. you have two SQL statements above.
Run them separately.
------ Solution --------------------
$ SQL = 'set @ rank = 0 ;';
Mysql_query ($ SQL );
$ Result = mysql_query ('select * FROM (SELECT @ rank: = @ rank + 1 AS rank, yb2000_event_phone, yb2000_event_point FROM yb2000_event WHERE yb2000_event_riqi = \ '2017-07 \ 'group BY yb2000_event_phone order by yb2000_event_point DESC) a WHERE. yb2000_event_phone = \ '2017 \'');
Mysql_query cannot execute multiple statements at a time. Separate execution.
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.