这个查询数据库的php为什么没有输出?
我是新手,写了一个查询mysql数据库的php,用post方式传递参数却没有输出,why?
<br /><?php<br /> $community = $_POST["community"];<br /> $db = new mysqli('xxxxx','xxxx','xxxx','xxxx');<br /> if(mysqli_connect_errno()) {<br /> echo '数据库连接失败!';<br /> $db->close();<br /> exit;<br /> }<br /> $query = "select * from sell where community = '".$community."'";<br /> $result = $db->query($query);<br /> $num = $result->num_rows;<br /> if($num == 0) {<br /> echo 'ERROR_NORESULT';<br /> }<br /> else {<br /> for($i = 0; $i < num; $i++) {<br /> $row = $result->fetch_assoc();<br /> echo row['price'].' '.['area'];<br /> }<br /> }<br /> $result->free();<br /> $db->close();<br />?><br />
<br /><?php<br />ini_set('display_errors','on');<br />error_reporting(E_ALL);<br /><br /> $community = $_POST["community"];<br /> $db = new mysqli('xxxxx','xxxx','xxxx','xxxx');<br /> if(mysqli_connect_errno()) {<br /> echo '数据库连接失败!';<br /> $db->close();<br /> exit;<br /> }<br /> $query = "select * from sell where community = '".$community."'";<br /> $result = $db->query($query);<br /> $num = $result->num_rows;<br /> if($num == 0) {<br /> echo 'ERROR_NORESULT';<br /> }<br /> else {<br /> for($i = 0; $i < $num; $i++) {<br /> $row = $result->fetch_assoc();<br /> echo row['price'].' '.['area'];<br /> }<br /> }<br /> $result->free();<br /> $db->close();<br />?><br />