I have this query and if it returns successful, I want another function to process, if not, do not process that function.
Here is the code for running the query
Check this:
<?php
if (mysqli_num_rows(mysqli_query($con, sqlselectquery)) > 0)
{
echo "found";
}
else
{
echo "not found";
}
?>
<!----comment ---for select query to know row matching the condition are fetched or not--->
if ($DB->rowCount() > 0)
{/* Update worked because query affected X amount of rows. */}
else
{$error = $DB->errorInfo();}
mysql_affected_rows
I understand that by saying "successful" you want to know if any rows have been updated. You can check it with this function.
If you use PDO -> http://www.php.net/manual/en/pdostatement.rowcount.php
mysqli_affected_rows
returns number of items affected.
You can use this to check if there are any results ($result) from a query:
if (mysqli_num_rows($result) != 0)
{
//results found
} else {
// results not found
}