[PHP-DB] Update/Insert

2002-04-26 Thread Natividad Castro
Hi to all, I have a form where users can insert or update a record. Now the way I have it, can just only do one thing either update or insert a new record. What I would like to do is: if it is a new record, execute the insert statement else execute the update statement. I don't know if it is

Re: [PHP-DB] Update/Insert

2002-04-26 Thread Chris
You could try inserting it, and see if it succeeds. If its fails, then you know you have to update it. IE $sql= 'insert...' $result = mysql_query($sql); if(!$result) { $sql = 'update...'; mysql_query($sql); } -Chris At 01:34 PM 4/26/2002 -0400, you wrote: Hi to all, I have a form where

Re: [PHP-DB] Update/Insert

2002-04-26 Thread Jason Wong
On Saturday 27 April 2002 01:34, Natividad Castro wrote: Hi to all, I have a form where users can insert or update a record. Now the way I have it, can just only do one thing either update or insert a new record. What I would like to do is: if it is a new record, execute the insert statement