Ask the php Resource question? This post was last edited by xuzuning at 10:40:28
Php Resource
"; Echo" return to registration page "; // die (mysql_free_result ($ res ). "Connection ". mysql_close ($ conn); mysql_free_result ($ res); mysql_close ($ conn); exit () ;}}$ sql2 = "insert into zhuche (Username, password) values ('". $ name. "','". $ pwd. "');"; $ res2 = mysql_query ($ sql2, $ conn) or die (mysql_error (); echo"
"; Echo"
Serial Number |
User |
Password |
"; While ($ row = mysql_fetch_row ($ res) {echo"
"; Foreach ($ row as $ key => $ val) {echo"
-- ". $ Val ." | ";} Echo"
";} Echo"
"; Mysql_free_result ($ res); mysql_close ($ conn);} sqlDql ($ name, $ pwd);?>If the first while clause does not exit, why can't the following $ res get data? There is no problem with the SQL statement.
The output result is
Reply to discussion (solution)
33 rows should be
While ($ row = mysql_fetch_row ($ res2 )){
Instead
While ($ row = mysql_fetch_row ($ res )){
$ Res2 is a boolean value with no result set
Oh, I got it wrong.
However, $ res is directed to the end of the result set after while ($ row = mysql_fetch_row ($ res) {.
You need to use mysql_data_seek ($ res, 1); to wrap the result set
However, please note: even if it is bypassed, the inserted values of mysql_query ($ sql2, $ conn) are not output.
Thank you very much.