How PHP extracts data // Receive data
// Use post for form verification
$ Conn = mysql_connect ('localhost', 'root', 'wampp ');
If (! $ Conn)
{
Echo "database connection failed". mysql_error ();
}
Else
{
Echo "database connection successful ";
}
// Set the encoding
// Double quotation marks are used.
Mysql_query ("set names 'gbk'") or die (mysql_error ());
// Select a database
Mysql_select_db ('ploy', $ conn) or die ("The cause of the error is". mysql_error ());
$ Id = $ _ POST ['id'];
$ Pwd = $ _ POST ['pwd'];
// Use the database for verification ,,
// Database statement
$ SQL = "select * from admin where id = $ id ";
// Database execution statement
$ Result = mysql_query ($ SQL, $ conn)
// Retrieve the associated array and the password corresponding to the ID number
If ($ row = mysql_fetch_array ($ result ))
{// Query the database and retrieve the database password
If ($ row ['pwd'] = $ pwd)
{
$ Name = $ row ['name'];
Header ("Location: manage. php? Name = $ name ");
Exit ();
}
}
Header ("Location: login. php? Error = 1 ");
Exit ();
?> The above is the code. this is the page code for processing user login. if ($ row = mysql_fetch_assoc ($ result) at runtime, there is no error in the database connection, always report an error. please answer
Reply to discussion (solution)
What is the error?
If the syntax is incorrect
$ Result = mysql_query ($ SQL, $ conn );
If the data type is incorrect
$ Result = mysql_query ($ SQL, $ conn) or die (mysql_error ());
Screenshot to see what is wrong
Post an error,
Incorrect IDE selection
The last and second if brackets are included in the final try