[Phpwm] incrementing values during an update

alan dunn alan at dunns.co.uk
Wed Sep 16 14:38:55 UTC 2009


I want to update a sub-set of records in a sql table. three of the 
values are fixed.

'devcount' I want to increment starting from 1 each time the query is 
run for a new $q_batch:

UPDATE tblprintq SET q_printed = 'A', printer = '$printer', conbatch = 
$condbatch, devcount = ??????
 WHERE q_batch = $q_batch
 AND q_printed = 'N'

I can do it by doing a SELECT to get the row ID, then incrementing a 
counter, then running an UPDATE on row ID, but is there a way of doing 
this within the query?

Thanks, alan dunn



More information about the Phpwm mailing list