This is a discussion on Return custom MySQL message in a stored procedure to PHP within the MySQL Database forums, part of the Database Forums category; I'm testing PHP and MySQL. I'd like to know if it's possible to have MySQL return a ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm testing PHP and MySQL. I'd like to know if it's possible to have
MySQL return a custom message back to PHP from a stored procedure. Currently most web apps have multiple calls to the database for one process. Say, process is to insert a record. First call checks to see if the record already exists. If not then second call is to insert the record. I'd like to have PHP call one stored procedure in MySQL to do both calls and return a custom message '..record already exists..' or '..record inserted..'. TIA... |
|
|||
|
On 12 Mar, 04:40, moua...@yahoo.com wrote:
> I'm testing PHP and MySQL. I'd like to know if it's possible to have > MySQL return a custom message back to PHP from a stored procedure. > Currently most web apps have multiple calls to the database for one > process. Say, process is to insert a record. First call checks to > see if the record already exists. If not then second call is to > insert the record. I'd like to have PHP call one stored procedure in > MySQL to do both calls and return a custom message '..record already > exists..' or '..record inserted..'. TIA... Rather than that, check out INSERT ... ON DUPLICATE KEY UPDATE and INSERT IGNORE. |