Im using the following code to remove an entry from a table what i want to do is to check if any value was deleted from the table.If one value is deleted,the script should print success else false.This is what i have achieved till now.Please help
<?PHP
$mysqli = new mysqli("SQLHOST.COM","CLIENT","PASSWORD", "DNAME", 1234);
if ($mysqli->connect_errno) {
printf("Connect failed: %s\n", $mysqli->connect_error);
exit();
}
else
{
printf("cONN Sucees");
if ($result = $mysqli->query("DELETE FROM ktable WHERE code='value'")) {
printf("Select returned %d rows.\n", $result->num_rows);
printf($result->num_rows);
$result->close();
}
}
?>
How about using execption. I also changed the code a little bit.
what you delete what you need to return is
affected_rows
http://www.php.net/manual/en/mysqli.affected-rows.phpWhat you need to Replace
Working Code
You should have a working output