Welcome Guest, Not a member yet? Register   Sign In
question on testing result of update(), insert(), and whether my approach works in ensuring unique data
#5

[eluser]Chillahan[/eluser]
Ah, you are right! That is what I was afraid of but wasn't thinking of. Update can be 100% "successful" just like selecting nothing can be.

But for insert() it wouldn't return true if it could not insert due to unique key constraint being violated, I assume - but, I guess it doesn't hurt to add a check for affected_rows() to that part of the code anyway. So just testing affected_rows() > 0 should be okay? I.e., if there's an error, affected_rows will still be available to be called, right (and won't throw a PHP error that breaks the flow).

Thanks a lot for the help too btw. I just wouldn't have thought to look more into affected_rows() otherwise!


Messages In This Thread
question on testing result of update(), insert(), and whether my approach works in ensuring unique data - by El Forum - 01-08-2011, 11:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB