我希望使用mysqli/prepared语句计算以下查询返回的记录数:
$mysql = new mysqli(DB_SERVER, DB_USER, DB_PASSWORD, DB_NAME) or die('There was a problem connecting to the database');
$stmt = $mysql->prepare('SELECT id,vcref,jobtitle,jobtype,jobintro,closingdate FROM jobs WHERE active = 1');
$stmt->execute();
$stmt->store_result;
$stmt->bind_result($id,$vcref,$jobtitle,$jobtype,$jobintro,$closingdate);
$stmt->fetch();
$totalLiveJobs = $stmt->num_rows();
输出一致为0
1条答案
按热度按时间rhfm7lfc1#
你用的是
mysql_stmt_num_rows
在oop风格中,将其作为函数调用是不正确的。尝试:而不是:
基本上,你想得到这个值:
也,
应该是: