Re: Maximum execution time of 30 seconds exceeded

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'd agree with what someone else said about keeping a separate table full of
possible pin numbers.

Fill it with all of the pin numbers to begin with, add in a "building" or
"department" row so you know what sequences go with what building, etc.

Then, to get a pin number for someone, you can just:

SELECT pin FROM Table WHERE ... ORDER BY RAND() LIMIT 1

Where the ... determines the correct building, department, whatever.

If you end up using that pin, delete it from the table. When the student
leaves, insert it back into the table.

---John Holmes...

----- Original Message ----- 
From: "Michael Cortes" <cortesm@fortleboeuf.net>
To: "Ben Lake" <ben.lake@archose.com>
Cc: <php-db@lists.php.net>
Sent: Monday, August 11, 2003 2:56 PM
Subject: Re:  Maximum execution time of 30 seconds exceeded


I do have an auto_increment for the record id.  But that is just a way for
me
to uniquely id the record.  Student numbers, barcodes, etc can change.

The reason I am using the do/while loop is:   Every student is getting a
4digit pin for library, cafeteria and network access.  It has to be unique
and we have been assigning a different range of numbers per building/grade.
There are various procedural reasons for this.  I have verified that I am
identifying the new student correctly and going into the do/while loop with
a
variable that holds the correct starting number for the appropriate pin
range.  It's then just a matter of trying consecutive numbers till I find an
available pin.  The pin may be available because a student left the school
or
because it's next available at the end of the line.

Anyway, I was not aware I could pick and choose my ranges in an
AUTO_INCREMENT
field.

I appreciate any thoughts you may have.  Thanks.


On Monday 11 August 2003 02:41 pm, you wrote:
> Why don't you use an AUTO_INCREMENT field in your table to define a
> unique number?
>
> Ben
>
> -----Original Message-----
> I had a do while loop such as
>
> do {
> mysql_query ($qupdate, $link);
> $rslterror=mysql_error($link);
> $number++
> } while ($rslterror!=null);
>
> Anyway, I fixed my dumb mistake.  If anyone would like to help me with a
> better one, maybe you can tell me if I am doing my do while correctly.
> It's only running through once, not getting a succesful insert  and
> dropping out.
>
> Thanks
>

-- 

Michael Cortes
Fort LeBoeuf School District
34 East Ninth Street
PO Box 810
Waterford PA 16441-0810
814.796.4795

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


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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux