Ask the php Resource question?

Source: Internet
Author: User
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"
  
  "; While ($ row = mysql_fetch_row ($ res) {echo" 
   
     "; Foreach ($ row as $ key => $ val) {echo" 
    ";} Echo" 
   ";} Echo" 
  
Serial Number User Password
-- ". $ Val ."
"; 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.