After entering the user name and password, you can query the information and modify the information. this is my code and the running result. How to display the database information and modify a certain item.
Student Information
Complete the Information"; Echo"
"; Exit;} else {$ query =" select * from $ student_table where xuehao = '$ xuehao' "; mysql_query (" set names 'gb2312 '"); $ result = mysql_query ($ query); $ row = mysql_fetch_array ($ result); if ($ row = 0) {echo"You have not registered. please register first.
"; Echo"
"; Exit;} $ query =" select password as sm from $ student_table where xuehao = '$ xuehao' "; mysql_query (" set names 'gb2312 '"); $ result = mysql_query ($ query); $ row = mysql_fetch_array ($ result); $ num = strlen ($ row ['xuehao']); $ xh = $ row ['xuehao']; $ n = 0; if ($ row [sm]! = $ Password) {echo"The student ID and password you entered do not match. please enter them again.
"; Echo"
"; Exit ;}}?>
Reply to discussion (solution)
$ Query = "select password as sm from $ student_table where xuehao = '$ xuehao '";
Mysql_query ("set names 'gb2312 '");
$ Result = mysql_query ($ query );
$ Row = mysql_fetch_array ($ result );
This section will overwrite the previous $ row, and you only have sm columns in the SQL list. Therefore, the following two rows will report an error.
$ Num = strlen ($ row ['xuehao']);
$ Xh = $ row ['xuehao']; // no xuehao column
The following control assignment also reports an error.
The solution is to change the second $ row to $ row1.
This is similar to a logon interface.
Thank you. the problem is fixed. The information is displayed normally. But what is the unnecessary error above?
$ Query = "select password as sm from $ student_table where xuehao = '$ xuehao '";
Mysql_query ("set names 'gb2312 '");
$ Result = mysql_query ($ query );
$ Row = mysql_fetch_array ($ result );
This section will overwrite the previous $ row, and you only have sm columns in the SQL list. Therefore, the following two rows will report an error.
$ Num = strlen ($ row ['xuehao']);
$ Xh = $ row ['xuehao']; // no xuehao column
The following control assignment also reports an error.
The solution is to change the second $ row to $ row1. thank you! After the problem is solved, it can be displayed normally, but what does the above error prompt mean?
$ Row [sm]
Change
$ Row ['SM ']
Sm is parsed as a constant without quotation marks.