Bluehost.com Web Hosting $6.95

Return custom MySQL message in a stored procedure to PHP

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 ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-12-2007
mouac01@yahoo.com
 
Posts: n/a
Default Return custom MySQL message in a stored procedure to PHP

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...

Reply With Quote
  #2 (permalink)  
Old 03-12-2007
Captain Paralytic
 
Posts: n/a
Default Re: Return custom MySQL message in a stored procedure to PHP

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.

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:23 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0