-3
警告:請求mysql_query()預計參數1是串,資源在C中給出:\瓦帕\ WWW \壽命\ homeSearch.php上線20警告:請求mysql_query()預計參數1是字符串,資源給定
代碼正在工作,但顯示上述錯誤。下面是代碼:
<?php
ob_start();
require("config.php");
ob_end_clean();
$req=$_REQUEST['propertyType'];
$req2=$_REQUEST['propertyStatus'];
mysql_connect("localhost",$username,$password);
mysql_select_db("$database") or die("Unable to select database");
if ($req!="all" && $req2!="all") $query= "SELECT * FROM buildings WHERE propertyType='$req' AND propertyStatus='$req2'";
else if($req=="all" && $req2!="all") $query= "SELECT * FROM buildings WHERE propertyStatus='$req2'";
else if($req!="all" && $req2=="all") $query= "SELECT * FROM buildings WHERE propertyType='$req'";
else if($req=="all" || $req2=="all") $query= "SELECT * FROM buildings";
$result=mysql_query($query);
$num=mysql_num_rows($result);
mysql_query($result);
mysql_close();
$i=0;
for ($i; $i < $num; $i++){
$f12=mysql_result($result,$i,"availability");
$f13=mysql_result($result,$i,"propertyType");
$f14=mysql_result($result,$i,"propertyStatus");
echo $f12." ".$f13." <br /> ".$f14."<br />";
}
?>
有這麼多的問題.... 它是一個重複的! – Naincy 2014-09-25 14:41:28
它不完全是一個重複的問題。我已經研究過它,並且沒有找到警告的答案 – eriq 2014-09-25 14:43:04
爲什麼你的第一步要問這裏的問題,而不是去php.net/mysql_query,並檢查什麼是參數命令應該是?這真的很難嗎?它甚至可以很好地告訴你問題是什麼。 – 2014-09-25 14:43:07