Subject | Re: [firebird-php] Duplicate numbers |
---|---|
Author | Lester Caine |
Post date | 2006-05-23T12:08:43Z |
Alan McDonald wrote:
$ticid and $office are replaced before it goes to Firebird :)
9 fields, 9 values, one of which is calculated from the list of todays
tickets.
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop -
http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php
>>I'm having a number of giggley little problems which are causing agro aIt's the PHP ;)
>>few times a week across some sites while some never have the
>>problem at all.
>>
>>The one that was spotted today is quite simple. Get ID from generator,
>>Add ticket with that ID, then process ticket.
>>
>>"INSERT INTO TICKET ( TICKET_ID, TICKET_REF, TICKET_NO, OFFICE, ROOM,
>>STAFF_ID, INIT_ID, CALLER_ID, APPLET )
>>VALUES ( $ticid, 'NOW', (SELECT COALESCE(MAX(TICKET_NO)+1, 1) FROM
>>CURRENT_DAY
>>WHERE OFFICE = $office AND TICKET_NO BETWEEN 0 AND 9999),
>>$office, 0, 0, 0, 0, ' ' )";
>
> I only see 2 place holders and 6 parameters? am I reading this right? I also
> only see 9 fields with 3 values.
> something ismissing here $office wold be used for $ticid - no?
$ticid and $office are replaced before it goes to Firebird :)
9 fields, 9 values, one of which is calculated from the list of todays
tickets.
>>I know that the MAX(TICKET_NO)+1 is not very safe, but the script seems--
>>to be getting run TWICE as I get TWO ID's, but the same TICKET_NO with
>>an almost identical 'NOW'.
>>
>>Anybody any ideas what can be happening. Is it possible that PHP is
>>running a script twice with two different transactions, from the same
>>browser (IE of cause) and the second run does not see the commit of the
>>first run? If that makes sens? I can't explain these occasional
>>duplicates any other way, as once the ticket is added the user gets a
>>'clear ticket before adding a new one' and also the Add Ticket button is
>>not present on the page that Add Ticket goes to!
>>
>>Anyone having similar strange niggles?
Lester Caine - G8HFL
-----------------------------
L.S.Caine Electronic Services - http://home.lsces.co.uk
Model Engineers Digital Workshop -
http://home.lsces.co.uk/ModelEngineersDigitalWorkshop/
Treasurer - Firebird Foundation Inc. - http://www.firebirdsql.org/index.php