我是想和PDO一起发挥功能 但这里的代码是获取错误(新到PDO)
function mail_id($mail){
global $host, $dbname, $user, $pass;
$DBH = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
$STH = $DBH->query("select count(from) from messages where from = $mail ");
$STH->setFetchMode(PDO::FETCH_ASSOC);
$row = $STH->fetch();
return $row;
}
我想数数一排 从这里,这是 外面,我正尝试
$mail=mail_id($userid);
if (0<count($mail[ to_viewed ])) {echo "green";} else {echo "gray";}
这就是错误
Call to a member function setFetchMode() on a non-object
请帮助帮助 Thx