Jump to content
Larry Ullman's Book Forums

Recommended Posts

with the mysqli_affected_rows() function can it be run more then once in a script that has more then 1 update or insert query?

 

like eg. I have an update query in a script and after the query is run I use

if (mysqli_affected_rows($dbc) == 1) { // if this table is updated only then update the other table.

$query2 = "UPDATE etc. etc."

$result2 = mysqli_query($dbc, $query2); // Can I use mysqli_affected_rows() again here?

} else { // First update did not work.

// echo error statement here.

}

Link to comment
Share on other sites

I just found it odd looking at it in a literal way because it's checking to see if mysql has an affected row then to run it again the affected row would have already been affected, unlike mysqli_num_rows where you have to also include the query and not just the database connection

Link to comment
Share on other sites

 Share

×
×
  • Create New...