Justtechjobs.com Find a programming school near you






Online Campus Both


php-db | 2004071

Re: [PHP-DB] Hold System From: Daniel Brunner (daniel.brunner <email protected>)
Date: 07/14/04

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 <email protected> -s
"Student Name Has Expired"

Then use CRON to start the Bash script at a certain time...

Dan

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php