我想返回时无法使用的一些数据不存在,但我认为有些事情是错误的,我的代码else和如果MySQL和PHP错误
$id=$_GET["id"];
$sql="SELECT * FROM book WHERE id = '".$id."' AND type = 'new'";
if(!empty($sql))
{
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
echo utf8_encode($row['bookreview']);
}
else
{
echo "<div style='text-align: center; background-color: rgb(255, 255,255);'><font style='color: rgb(204, 0, 0);' size='+3'><span style='font-weight: bold;'>review not not available.</span></font><br>";
}
如果审核,请其返回而如果回顾不可用“审查不可用”不会回显。
你正在使用带有$ sql值的if语句,并且allways有数据,而是使用$ result。 – Juanma 2012-02-28 12:28:24