mysqli_query() always returns true even when it does not change record update

Asked

Viewed 76 times

0

I am running the query in the database:

UPDATE store SET status = '0' WHERE id ='325'

And always returns true even if the value is not updated, and how much use the function mysqli_num_rows($link) of parameter error mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given,

The query is formed like this:

Update('store', array('status' => 0), "id ={$arr['store]['id']}'");

The parameters are: tabela, array campos=>valor and cláusula where

  • The function returns true for the query was successfully applied, regardless of whether or not you made the changes. Use mysqli_affected_rows to check if any registry has been modified.

  • Returns true pq gave no error, if the database has autocommit turned off it will not save. To find out how many lines have been modified use mysqli_affected_rows($link)

  • @Valdeirpsr lol I thought I had already tested with mysqli_affected_rows, vlw!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.