mysql - PHP generate ticket for queue system and able to reset the ticket number on the next day -


i want use php make simple queue system ticket generate when customer choose option. main requirements are:

  1. generate ticket number format (eg. c0001, e0001), alphabet represent different option customer choose.
  2. able reset number next day (staff click reset button).
  3. each records need stored in mysql.

below got, got 2 table (ticket_id , ticket) , 1 trigger:

ticket_id

create table `ticket_id` (`ticket_id` int(5) not null) engine=innodb default charset=latin1; 

ticket

create table `ticket` (`ticket_id` int(5) not null,  `ticket_name` varchar(5) not null default '''0''', `ticket_type` varchar(25) not null, `ticket_time` datetime not null ) engine=innodb default charset=latin1; 

trigger

create trigger `tg_ticket_insert` before insert on `ticket`  each row begin   insert ticket_id values (null);   set new.ticket_name = concat('a', lpad(last_insert_id(), 4, '0')); end 

newticket

$query = "insert ticket (ticket_type, ticket_time)           values ('$in_tickettype', now())           "; 

reset

$query = "update ticket set           ticket_name = default           ticket_time = now() + interval 1 day           "; 

the trigger works generate number, don't know how reset number. anyway know trigger not option whole thing done, if got better solutions please me.


Comments

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -