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