确保是否删除表中的行

时间:2013-08-21 04:52:15

标签: php mysql

      function child_delete($c_no, $shift, $p_date, $dname) {
                  $p_status = 0;
                  $query = "DELETE  from $this->tb1_name2 WHERE c_no=? AND time_slot=? AND      p_date=? AND d_name=? AND p_status=?";
                  $statement = $this->connection->mysqli_conn->prepare($query) or  die(mysqli_error($this->connection->mysqli_conn));
                  $statement->bind_param("dsssd", $c_no, $shift, $p_date, $dname, $p_status) or  die(mysqli_error($this->connection->mysqli_conn));
                  $result = $statement->execute() or die(mysqli_error($this->connection->mysqli_conn));

                  print_r(mysqli_affected_rows($statement));
}

我使用上面的代码来删除表中的行,并确保删除该行的天气。但它会出现以下错误。

      <b>Warning</b>:  mysqli_affected_rows() expects parameter 1 to be mysqli, object given in <b>/opt/lampp/htdocs/NEW/patient_channel/controller/Patient_controller.php</b> on line <b>318</b><br />

1 个答案:

答案 0 :(得分:1)

尝试阅读fine manual

echo $this->connection->mysqli_conn->affected_rows;