Why is PHP for this query database not output?

Source: Internet
Author: User
I am a novice, wrote a query MySQL database PHP, the post method to pass parameters but no output, why?
 
  Close (); exit;} $query = "SELECT * from sell where community = '". $community. "'"; $result = $db->query ($query), $num = $result->num_rows;if ($num = = 0) {echo ' Error_noresult ';} else {for ($i = 0; $i < num; $i + +) {$row = $result->fetch_assoc (); Echo row[' price ']. ' '. [' Area '];}} $result->free (); $db->close ();? >


Reply to discussion (solution)

11 lines num_rows?
16 Rows $i < p="">

New Mysqli, the host name, user name, password, and database name, are XXXX??

11 lines num_rows?
16 Rows $i < p="">
Clerical error, line 16 is $i < $num

New Mysqli, the host name, user name, password, and database name, are XXXX??


Of course not, I'm not good to give you the account and password to call out

 
  Close (); exit;} $query = "SELECT * from sell where community = '". $community. "'"; $result = $db->query ($query), $num = $result->num_rows;if ($num = = 0) {echo ' Error_noresult ';} else {for ($i = 0; $i < $num; $i + +) {$row = $result->fetch_assoc (); Echo row[' price ']. ' '. [' Area '];}} $result->free (); $db->close ();? >

Strange, there is no add $ in front of the variable name, your page does not have an error?
for ($i = 0; $i < $num; $i + +) {
$row = $result->fetch_assoc ();
echo $row [' price ']. ' '. $row [' area '];
}

Strange, there is no add $ in front of the variable name, your page does not have an error?
for ($i = 0; $i < $num; $i + +) {
$row = $result->fetch_assoc ();
echo $row [' price ']. ' '. $row [' area '];
}


No error, a blank. Thank you moderator, too careless!

As you can see from your code, each branch will have output.
If it is a blank, it means that you test the code fatal error, and do not open PHP error display function (oneself to make trouble for oneself)

You can also first put $community = $_post["Community"; print it out and see.

  • 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.