if ($area == Null || $area == "Area of City") {
$ment = "CREATE OR REPLACE VIEW water
AS SELECT postable.postid, description, dated, image, posterid, country, state, city, area, cat
FROM postable
INNER JOIN ".$_GET['Cat']."
ON postable.postid = ".$_GET['Cat'].".postid
WHERE ".$_GET["Cat"].".cat = '".$_GET["what"]."'
AND postable.country = '".$_GET["Country"]."'
AND postable.state = '".$_GET["State"]."'
AND postable.city = '".$_GET["City"]."'";
}
$ment = "CREATE OR REPLACE VIEW water
AS SELECT postable.postid, description, dated, image, posterid, country, state, city, area, cat
FROM postable, ".$_GET["Cat"]."
WHERE (
(postable.postid = ".$_GET["Cat"].".postid
AND ".$_GET["Cat"].".cat = '".$_GET["what"]."'
AND postable.country = '".$_GET["Country"]."'
AND postable.state = '".$_GET["State"]."'
AND postable.city = '".$_GET["City"]."'
AND postable.area = '".$area."')
OR
(postable.postid = ".$_GET["Cat"].".postid
AND ".$_GET["Cat"].".cat = '".$_GET["what"]."'
AND postable.country = '".$_GET["Country"]."'
AND postable.state = '".$_GET["State"]."'
AND postable.city = '".$_GET["City"]."')
)";
$tester = "SELECT * FROM water, userguy
WHERE userguy.posterid = water.posterid";
if (!mysql_query($ment, $con)) {
die('There are no posts matching your search, please enter another search in either another location or category, or both. ');
}
if (!mysql_query($tester,$con)) {
die('There are no posts matching your search, please enter another search in either another location or category, or both.');
}
$result = mysql_query($tester,$con);
while ($row = mysql_fetch_array($result)) {
if ($row == Null) {
echo "<tr><td colspan'4'>There are no posts matching your search, please enter another search in either another location or category, or both.</td></tr>";}
echo "<tr><td colspan='4' class='sult'>";
echo "<div id='main'>".$row['description']."</div> ".$row['dated']." <a href='mai.php?tofield=".$row['email']."'><b>".$row['email']."</b></a><b> ".$row['mobile']."</b>";
if ($row['image'] != Null) {
echo "<img src='upload/".$row['image']."' class='relt'/>";
}
echo "</td></tr>";
}
?>
<tr>
<td colspan='4'>
<br/><br/><br/><br/>
</td>
</tr>
<tr>
<td colspan='2' align='center'>
<img src='first.jpg'/>
</td>
<td colspan='2' align='center'>
<img src='second.jpg'/>
</td>
</tr>
<tr>
<td colspan='2' align='center'>
<img src='high.jpg'/>
</td>
<td colspan='2'></td>
</tr>
</table>
</body>
好返回任何東西,現在,這個代碼工作在我的電腦,我用它來開發這個我的網站上,這是它從數據庫返回的行。但是,當我將這段代碼放到我的網站上時,它不會返回任何內容,實際上,腳本甚至不顯示任何內容。我會很感激,如果我可以得到任何幫助,它現在已經讓我不眠之夜太久了...PHP while循環不在服務器上
你有相同的數據和日相同的mysql相同的登錄數據(主機,用戶,密碼)?你是否收到error_reporting的錯誤消息? – Anonymous
哦,我的這段代碼非常需要一些正確的格式和縮進。我強烈建議花一些時間學習和實現Drupal編碼標準(http://drupal.org/coding-standards),或者簡單地做一個Google搜索「php編碼標準」,看看還有什麼。你的灰色細胞(以及你尋求幫助的人)會感謝你。 :) –
@BrianShowalter在易讀性問題中重新分配代碼......並立即發現了幾個問題,同時這樣做... – DaveRandom