<? include"adminnew/config.php"; if($key==''){ echo"<script>alert('请填写 关键字 !');history.go(-1);</script>"; die(); } $f="select $select from $table_image where key like '%$key%'"; $p=mysql_query($f); $num=mysql_num_rows($p); if($num) { echo"搜到 $num 条记录!"; } else { echo"搜到<font color=#ff0000>0</font>条记录!"; }?>
to:: vivanboy(被迫早起的鸟儿) 提示:Warning: Supplied argument is not a valid MySQL result resource in e:\web\nyist\find.php on line 9 搜到0条记录! 第九行:$num=mysql_num_rows($p);
每次都执行return;
so就这样
include"adminnew/config.php";
if($key==''){
echo"<script>alert('请填写 关键字 !');history.go(-1);</script>";
die();
}
$f="select $select from $table_image where key like '%$key%'";
$p=mysql_query($f);
$num=mysql_num_rows($p);
if($num)
{
echo"搜到 $num 条记录!";
}
else
{
echo"搜到<font color=#ff0000>0</font>条记录!";
}?>
搜到0条记录! 第九行:$num=mysql_num_rows($p);
1.你的查询语句错误
2.你没有选择数据库或者选择了错误的数据库用
echo mysql_error();
看看错误提示。另外将你的$f这个语句echo 出来看看