tags:

views:

17

answers:

1

When I delete a record from the database, even when it is successful, all I ever get is int(0). What am I doing wrong? The manual does not give an example of this with a procedure.

$foo = db::getInstance()->exec("CALL deleteUser(222)");
A: 

My hunch is that it has something to do with the fact that you are calling an SP instead of a 'regular' SQL query. I'm not too familiar with SP's, but maybe you should return the number of deleted rows from within the SP? Just a thought.

fireeyedboy
Well, like I said bebo, unfortunately I'm not really familiar with SP's. So I'm kind of guessing here also. But have you tried executing a regular DELETE statement with exec() yet? If not, try it, and see if that *does* return the expected value. That way you can be pretty sure the problem lies in the calling of an SP. Meanwhile have a look at example #5 here:http://www.php.net/manual/en/pdo.prepared-statements.phpIt shows a way to return a value from a SP by using bindParam() and execute()
fireeyedboy
It appears that only a function will return a result. PDO claims to do this but I have yet to see it. I just verified it..
bebo
Thanks.. I will go there now.. Appreciate all the help.
bebo