Re: Update/Insert
| From: | Chris | Date: | Fri, 26 Apr 2002 17:59:47 +0000 |
| Subject: | Re: Update/Insert | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-18837@lists.php.net to get a copy of this message | ||
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 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 possible to do it in PHP. Any help is greatly appreciate Thanks in advanced! Nato -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php