首先我想告诉我,我已经去ALL DUPLICATE问题。并尝试了在那里建议的更改。PHP- mysqli-> num_rows总是返回0,Prepared语句
至于现在,我已经试图改变num_rows
到num_rows()
并采用store_result();
并采用affected_rows()
。
后
还呼吁store_result();
我觉得可能是我无法弄清楚
$conn->autocommit(false);
if ($sucess){
$stmt2 = $conn->prepare("UPDATE e_eventqueue SET e_urlfil=? WHERE e_id=?
AND u_id=?");
$stmt2->bind_param("iis",$e_urlfil,$e_id,$u_id);
if($stmt2->execute()){
$stmt2->store_result();
echo "true";
echo $stmt2->num_rows; // <- this always return 0 even when its not
$stmt2->close();
$conn->commit();
}
else{
$conn->rollback();
echo "rollback";
}
}
你实际更新什么?如果'UPDATE'结果没有变化,MySQL可以报告0行受影响 – Phil
对于更新查询您需要检查affected_rows。不是num_rows – JYoThI
@Phil是的,我每次都更新不同的值,这在phpmyadmin中是可见的 – GeekWithGlasses