[Phpwm] incrementing values during an update
phil at infolinkelectronics.co.uk
phil at infolinkelectronics.co.uk
Wed Sep 16 15:33:22 UTC 2009
I thought the previous answer was too easy! :-)
The fact you have defined q_batch is useful in that it is bt definition a
finite array - could the required value not then be determined and contained
within this array as a subset and extracted as it's parsed by the SELECT?
devcount = $qbatch[devcount]
Phil
> sorry, I didn't make it clear devcount is initially null in each row. So
> the value in row 1 becomes 1, in row 2, 2 etc.
>
> phil at infolinkelectronics.co.uk wrote:
> >
> >
> >
> >> -----Original Message-----
> >> From: phpwm-bounces at mailman.lug.org.uk
> >> [mailto:phpwm-bounces at mailman.lug.org.uk]On Behalf Of alan dunn
> >> Sent: 16 September 2009 15:39
> >> To: phpwm
> >> Subject: [Phpwm] incrementing values during an update
> >>
> >>
> >> 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
> >>
> >
> >
> > SET devcount=devcount+1
> >
> > Regards,
> >
> > Phil Beynon
> > Sales & Operations Director
> >
> > ** Infolink Electronic Systems Ltd.
> > ** S/W Birmingham's Longest Established ISV & VAR
> > ** http://www.infolinkelectronics.co.uk
> > ** Professional Web 2.0 Design & Advanced Hosting Platforms
> > ** http://www.coeus-computica.co.uk
> > ** Affordable Knowledgebase Solutions
> > ** Contact: Sales at infolinkelectronics.co.uk
> > ** Tel / Fax 0121 441 3558
> > _______________________________________________
> > Phpwm mailing list
> > Phpwm at mailman.lug.org.uk
> > https://mailman.lug.org.uk/mailman/listinfo/phpwm
> >
>
> _______________________________________________
> Phpwm mailing list
> Phpwm at mailman.lug.org.uk
> https://mailman.lug.org.uk/mailman/listinfo/phpwm
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.409 / Virus Database: 270.13.98/2371 - Release Date:
> 09/16/09 05:51:00
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Phil Beynon.vcf
Type: text/x-vcard
Size: 636 bytes
Desc: not available
Url : http://mailman.lug.org.uk/pipermail/phpwm/attachments/20090916/d8d2daed/attachment.vcf
More information about the Phpwm
mailing list