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