|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-07-03 19:32 UTC] rasmus at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Jun 11 07:00:02 2026 UTC |
Hi, I have configured php3 as an apache module (as in the documentation). I am using a modified version of stonekeep's Keystone system. We have modified the database and use a date-based counter that stores ticket id's as yyyymmddn. n increments for each new ticket and rollsover at midnight. I have written some code to handle this and this was working fine, until monday. Now I get odd increments in the database, i.e. 'n' skips. It's as if the increment part of the code is being run although no tickets match the 'missing' numbers. Here is my code: if($db_result[lastdate_value]==$long_date) { db_query("update laststate set last_ticketid=last_ticketid+1"); LogIt("INFO","postslip.php3","Old ticket vars: $db_result[lastdate_value] $db_result[last_ticketid]"); } else { db_query("update laststate set last_ticketid=$default_stateval"); db_query("update laststate set lastdate_value=$long_date"); } The mysql database stores the last values in a table as follows: # mysqlshow flash laststate Database: flash Table: laststate Rows: 1 +----------------+------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +----------------+------------+------+-----+---------+-------+ | lastdate_value | int(16) | YES | | | | | last_ticketid | bigint(11) | YES | | | | +----------------+------------+------+-----+---------+-------+ I use bigint as I was getting a rollover with 'int'. Then a piece of code 'assembles' the date and the new incremented last_ticketid value, as follows: #ok, now query the db for the new human ticket id just created above... $newdb_query = db_query("select * from laststate"); $newdb_result = db_fetch_array($newdb_query); $human=$newdb_result[lastdate_value].$newdb_result[last_ticketid]; This $human variable is then inserted into the slips table in a custom, bigint field called 'human_sid'. Any help on this issue would be a great help! Regards, Matt Duggan, mailto:matt@insnet.net