Why the hell would you want to do that?

It looks ugly?

I'll tell you what, when you have 80000 records in the database, and #34,501
is missing, I wonder if you'll notice, or want to write code to fill, the
"hole"

if you really want to fix the hole (as much as I think you are seriously
wasting your time, and a sneaking suspicion as to why you would actually
want to do it)..

You would have to pull the data down into an arrya, loop through the array
from start to finish, all the while checking if the current ID equals the
counter value, as soon as it doesn't, you know you have found an ID you can
insert into the DB safely. Ofcourse, if there are records in other tables
related by that ID, and you forgot to delet those, you'll get some really
weird results.

Not to mention the extra time your code would be taking to execute.

if I saw someone writing all the code to patch holes in record sequences, I
would fire them. But thats just me. I'd rather have my employees working on
making things better, not slower for no reason at all other than 'i like
pretty sequences'


However, I'm guessing its because you actually want to create < PREV | NEXT
> next buttons, and you can't think of a way to link up the records.

If thats the case, email me back, and I'll send you some example code which
should (perhaps), make your life much simpler.


-----Original Message-----
From: Bobo Wieland [mailto:[EMAIL PROTECTED]]
Sent: Friday, 17 January 2003 10:14 PM
To: [EMAIL PROTECTED]
Subject: [PHP-WIN] SQL-query


I hope this isn't to much OT... Sorry if it is...

In my MySQL-db that I use for a php-driven site I have many tables with the
Primary Key set as an auto increment value.

If I have 4 records with id 1, 2, 3 and 4 and then delete number 3 and add
one more record I get the id's 1,2,4 and 5. It isn't much of a problem, but
it would be nice to check for the first "hole" in the id's and insert the
record there instead. How would you do this? is there some simple way from
either MySQl or PHP  that doesn't take to much time to execute?

thanks in advance


. bobo . www.elstudion.com . [EMAIL PROTECTED] .




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


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

Reply via email to