About Warning: mysql_fetch_array (): suppliedargumentisnotavalidMySQLresult
$ Con = mysql_connect ("localhost", "root", "", "PhysicalTest ");
If (! $ Con)
{
Die ('could not connect: '. mysql_error ());
}
Mysql_select_db ("PhysicalTest", $ con );
Mysql_query ("set names 'gbk _ chinese_ci '");
Error_reporting (E_ALL ^ E_NOTICE );
If (isset ($ _ COOKIE ['student _ id'])
{
$ Student_id = $ _ COOKIE ['student _ id'];
}
$ Result = mysql_query ("SELECT * FROM score WHERE student ID = '$ student_id '");
$ Row = mysql_fetch_array ($ result );
If (empty ($ row) echo "script alert ('No matching items found '); script";
Else {
Echo <HTML
...
Why is there warning, mysql_fetch_array (): supplied argument is not a valid MySQL result... The database table is correct... Ask what is going on.
Reply to discussion (solution)
$ Result = mysql_query ("SELECT * FROM score WHERE student ID = '$ student_id '");
Query failed
You can use echo mysql_error () to check what is wrong.
It is estimated that it is a problem with the Chinese table name and field name.
$ Result = mysql_query ("SELECT * FROM score WHERE student ID = '$ student_id'") or die (mysql_error ());
Check for any errors.
$ Result = mysql_query ("SELECT * FROM score WHERE student ID = '$ student_id '");
Query failed
You can use echo mysql_error () to check what is wrong.
It is estimated that it is a problem with the Chinese table name and field name.
Bytes --------------------------------------------------------------------------------------
The result is as follows: 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 'WHERE student ID = ''' at line 1
Is it because the table name and column name are in Chinese? Should I change it to English?
Try this first
$ Result = mysql_query ("SELECT * FROM 'score 'where' student ID '=' $ student_id '");
But it's not a long term. you don't want to start an English name. you can also use Chinese pinyin.
Try this first
$ Result = mysql_query ("SELECT * FROM 'score 'where' student ID '=' $ student_id '");
But it's not a long term. you don't want to start an English name. you can also use Chinese pinyin.
No more Chinese characters next time. thank you.