Mysql_fetch_array (): usage: myapacheweb mysql_fetch_array (): supplied argument is not a valid MySQL result resource
Warning: mysql_fetch_array (): supplied argument is not a valid MySQL result resource in D: \ myapacheweb \ test \ self_info.php on line 7
PHP code
Mysql_connect ("localhost", "root", "1"); $ query = "select id from computer where user = 'test2'"; $ result = mysql_query ($ query ); echo "test2 used
"; While ($ row = mysql_fetch_array ($ result) {echo $ row ['id']." start time ". $ row [starttime]."
";}
Help
------ Solution --------------------
$ Query = "select id from computer where user = 'test2 '";
Echo $ query
Run the SQL statement in the database to check whether there is any data.
This problem is generally caused
SQL statement error,
Or this data does not exist in the database.
,
------ Solution --------------------
The SQL statement is incorrect!
------ Solution --------------------
Generally
$ Result = mysql_query ($ query );
Written:
$ Result = mysql_query ($ query, $ conn );
------ Solution --------------------
You have not specified a database? --
$ Result = mysql_query ($ query );
Change this
$ Result = mysql_db_query ('database name', $ query );
------ Solution --------------------
Discussion
Generally
$ Result = mysql_query ($ query );
Written:
$ Result = mysql_query ($ query, $ conn );