以下是我的代码
//FIRST UPDATE QUERY
$firstupdatequery = "UPDATE `register` SET suser ='1' ";
//Second UPDATE QUERY
$updater = "UPDATE `register` SET suser ='$suser',steamleader ='$steamleader',ipdate ='$ipdate',customer ='$customer',cperson1 ='$cperson1',mobile1 ='$mobile1',phone ='$phone',fax ='$fax',email ='$email',website ='$website',pincode ='$pincode',state ='$state',city ='$city',address ='$address',status ='$status',data_resource ='$data_resource',comments ='$comments',data_status ='$data_status',followup_date ='$followup_date',last_followup_date ='$last_followup_date',last_comment ='$last_comment',data_assign ='$data_assign',bank_id = '$bank_id' WHERE id = ".$getid."";
$exequery = $conn->query($updater);
if($exequery){
if(mysqli_affected_rows($conn) > 0){
//insert for followup recored
echo "<pre>";
print_r($conn);
echo $conn->affected_rows;
exit;
//And than I am running another insert query here
此代码显示是否已更新了任何行,因此我运行了另一个插入查询。但是问题是当我按下按钮而不更改任何值时仍然是mysqli对象affected rows
计数为1。
mysqli Object
(
[affected_rows] => 1
为什么这对1
进行计数,即使我没有更改任何值。*
注意:我正在此代码上方更新一行
有一个技巧,我称它为肮脏的秘诀,但我不知道这样做的更干净的方法
list($matched, $changed, $warnings) = sscanf($conn->info, "Rows matched: %d Changed: %d Warnings: %d");