Sometimes I need to know MySQL has found the record or no. I don't mean to know is there affected rows or not, just finding.
$db = database_system::connect();
$query = "UPDATE member SET username=?,password=? WHERE id=?";
$stmt = $db->prepare($query);
$stmt->bind_param("ssi",$this->username,$this->password,$this->id);
$stmt->execute();
$stmt->store_result();
if(!$stmt->affected_rows) throw new Exception("something about");
$stmt->close();
For example, php code above will throw exception if there is no affected record, but I wanna throw exception when there there is no such user (with that ID).