PEAR DB numrows 总是返回1

JPR5688 2009-12-01 12:01:35
require_once 'DB.php';
$dsn = 'mysql://rc:rc@localhost/rc';
$db = & DB::connect($dsn);



if(DB::isError($db))
{
die($db->getMessage());
}
$sql = "select count(*) from users where email='".$_POST['email']."' and pwd='".$_POST['pwd']."'";
$result = & $db->query($sql);
if(DB::isError($result))
{
die($result->getMessage());

}


$num = $result->numRows(); //这句总是返回1 不知道为什么,哪怕是空数据库
if($num >0)
{
session_start();
$_SESSION['islogin']= true;
header("location:rclist.php");
}
...全文
150 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
ruanchao 2009-12-01
  • 打赏
  • 举报
回复
$sql = "select id from users where email='".$_POST['email']."' and pwd='".$_POST['pwd']."'"; 



$num = $result->numRows();返回还是1吗?

21,891

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧