Aleksandr V. Dyomin wrote:
$key='somekeyvalue';
dbquery("update sometable set count=count+1 where keyfield='$key'");
if(mysql_affected_rows()<1)
dbquery('insert into sometable set keyfield='$key', count=1');
Another possibility would be
INSERT IGNORE INTO sometable SET keyfield = '$key', count = 0;
UPDATE sometable SET count = count + 1 WHERE keyfield = '$key';
--
Keith Ivey <[EMAIL PROTECTED]>
Washington, DC
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]