[PHP-DB] remove from db renumbering

2002-06-30 Thread Chris Payne

Hi there everyone,
 
I have my id field auto incrementing (Of course) and I have a utility
that allows me to remove items from it, the problem is when I remove
something the items after it keep their ID’s leaving a gap in the ID.
For example, say I have 1-10 in the ID field and I remove number 8, I’ll
have 1-7 and then 9-10, what I need is for 9-10 to go down to 8-9, how
can I do this?  It’s really important as I have an ad-rotator system
which gets the total number of fields from the DB and if there is an
empty ID it causes there to be an invalid image appear (Of course).
 
So all I need is to renumber the ID field after a delete I guess, but
how?
 
Any help would be extremely grateful :-)
 
Thanks
 
Chris
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002
 



Re: [PHP-DB] remove from db renumbering

2002-06-30 Thread Raquel Rice

On Sun, 30 Jun 2002 20:21:18 -0400
Chris Payne Chris Payne [EMAIL PROTECTED] wrote:

 Hi there everyone,
  
 I have my id field auto incrementing (Of course) and I have a
 utility
 that allows me to remove items from it, the problem is when I
 remove
 something the items after it keep their ID’s leaving a gap in the
 ID.
 For example, say I have 1-10 in the ID field and I remove number
 8, I’ll
 have 1-7 and then 9-10, what I need is for 9-10 to go down to 8-9,
 how
 can I do this?  It’s really important as I have an ad-rotator
 system
 which gets the total number of fields from the DB and if there is
 an
 empty ID it causes there to be an invalid image appear (Of
 course).
  
 So all I need is to renumber the ID field after a delete I guess,
 but
 how?
  
 Any help would be extremely grateful :-)
  
 Thanks
  
 Chris

If all you want to do is to get a record count, why not
SELECT COUNT(*) AS recs FROM datatable

-- 
Raquel

Above all things, never be afraid. The enemy who forces you to
retreat is himself afraid of you at that very moment.
  --Andre Maurois

  
  

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