Why does this SQL statement always fail?
$idinfo =mysql_fetch_array ("select * from Tb_yonghu where name= ' $name ' and id= ' $id '") or Die ("Access failed");
Is the statement itself a problem? Is there any relationship between $name and $id plus single quotes?
In front of Echo $name and $id both have values and are the same as the values in the database
Why do I always show access failures?
The database connection should be fine because the database link fails if there is a problem
------Solution--------------------
Die ("Access Failed") indicates that "Access failed" is displayed as long as the mysql_fetch_array execution is unsuccessful, so you cannot conclude that there is no problem with the database connection.
------Solution--------------------
Look at the manual, Mysql_fetch_array is the execution resource, not the statement.
PHP Code
$rs =mysql_query ("select * from Tb_yonghu where name= ' $name ' and id= ' $id '") or Die ("Access failed"); $idinfo =mysql_fetch_array ($RS);
------Solution--------------------
The function to execute SQL is mysql_query (), your own first officer nets the next php_manual to see ripe.
------Solution--------------------
Manual to carry ...