Re: Hold System

From: Date: Wed, 14 Jul 2004 21:04:21 +0000
Subject: Re: Hold System
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-35258@lists.php.net to get a copy of this message
Hello!!
CREATE TABLE hold_tracker ( id int(11) NOT NULL auto_increment, STUDENT_ID int(11) NOT NULL default '0', USER_ID int(11) NOT NULL default '0', valid char(1) NOT NULL default '1', date_held bigint(20) NOT NULL default '0', date_created bigint(20) NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM AUTO_INCREMENT=12 ; This works okay, for just keep track of who is holding the student. There are some restrictions: 1. A Coordinator may only hold 3 students at a time. (PHP logic, this is done already.) 2. A Coordinator can only hold a student while in the #1 position for a certain amount of time. (I don't have a problem with calculating the time.The problems are: A. What do I do with the record once there hold has expired? Who checks for this???
If it's user based, then that's easy...Have a user run some type of report, or something like that But if you/they want this automatic, then it's a little more involved... What I've done in the past..Running Linux of course... Create a mysql query text file and save it..(example) SELECT STUDENT_ID FROM hold_tracker WHERE USER_ID = 'blah' Create a bash script...(Example) #!/bin/sh # # # mysql database_name -uJoe -pblow <query | mail whatever@whatever.com -s "Student Name Has Expired" Then use CRON to start the Bash script at a certain time... Dan

« previous php.db (#35258) next »