On Sun, Jul 13, 2003 at 09:52:10AM -0400, Paul Chvostek wrote:
...
>   $q  = "UPDATE table SET value=value+$value WHERE id='$id';";
>   $q .= "INSERT INTO table (id,value) VALUES ('$id',$value)";
>   @mysql_query($q);

Woop, I forgot this was the mysql list, not a php- list.  ;-)

The basic thing here is the fact that you can:

  mysql> UPDATE table SET value=value+10 WHERE id='20030713';

as long as the record exists.  And as long as you can check for success
or failure of your UPDATE, you can determine whether you should run an
INSERT to load an original record with this id.

-- 
  Paul Chvostek                                             <[EMAIL PROTECTED]>
  it.canada                                            http://www.it.ca/
  Free PHP web hosting!                            http://www.it.ca/web/


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to