473,386 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

troubles remeving records

i have a news system which runs off the id of the news item,

the system allows the owner to delete a record if the wish,
this removes the record from the database taking with it that auto_incriment
ID

so i would end up with

ID
----
38
39
41
42
etc

so when someone views article 39 and i do

<a href=news.php?id=<?php $id+1; ?> for the "next>>" button and record 40
doesnt exist it errors

how can i resort the table to suffle all the id's so there are no gaps like
this
Thanks

Greg
Jul 20 '05 #1
4 1339
Greg Brant wrote:
so when someone views article 39 and i do

<a href=news.php?id=<?php $id+1; ?> for the "next>>" button and record 40
doesnt exist it errors

how can i resort the table to suffle all the id's so there are no gaps like
this


If you don't want re-order id values in your table, you could use a
query like this, to find the next id:

select min(id) from tablename where id > 39;
Jul 20 '05 #2
Greg Brant wrote:
so when someone views article 39 and i do

<a href=news.php?id=<?php $id+1; ?> for the "next>>" button and record 40
doesnt exist it errors

how can i resort the table to suffle all the id's so there are no gaps like
this


If you don't want re-order id values in your table, you could use a
query like this, to find the next id:

select min(id) from tablename where id > 39;
Jul 20 '05 #3
i want do bump all the ID's down to fill in the empty space left by
deleating a record
"Aggro" <sp**********@yahoo.com> wrote in message
news:OK***************@read3.inet.fi...
Greg Brant wrote:
so when someone views article 39 and i do

<a href=news.php?id=<?php $id+1; ?> for the "next>>" button and record 40 doesnt exist it errors

how can i resort the table to suffle all the id's so there are no gaps like this


If you don't want re-order id values in your table, you could use a
query like this, to find the next id:

select min(id) from tablename where id > 39;

Jul 20 '05 #4
i want do bump all the ID's down to fill in the empty space left by
deleating a record
"Aggro" <sp**********@yahoo.com> wrote in message
news:OK***************@read3.inet.fi...
Greg Brant wrote:
so when someone views article 39 and i do

<a href=news.php?id=<?php $id+1; ?> for the "next>>" button and record 40 doesnt exist it errors

how can i resort the table to suffle all the id's so there are no gaps like this


If you don't want re-order id values in your table, you could use a
query like this, to find the next id:

select min(id) from tablename where id > 39;

Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Vladimir Ignatov | last post by:
Hello! I have a big CSV file, which I must read and do some processing with it. Unfortunately I can't figure out how to use standard *csv* module in my situation. The problem is that some...
0
by: lmckaha | last post by:
Hi, Mysql version: 3.23.49 Solaris version: 2.7 gcc compiler version: 2.95.2 Python : 2.2.2 I'm evaluating the C and C++ API to decide which one to bye but I have many troubles.
2
by: J-W Reuling | last post by:
Hi, I'm using replication on linux and aix for a while now. I've set up several replications from aix to aix, from linux to aix and vice versa. It was running just fine until a few days ago. I...
3
by: Eagle | last post by:
Hi all, This one's drivin' me nuts. Any help would be appreciated. (Access 2000). I have 3 tables: tblTools: having the basic data of a tool and a field (txt) showing yes or no with regard to...
1
by: Ray Holtz | last post by:
I have a database in Access 2003 (Access2000 file format). There are two tables that are being used: Employees and Items. It is linked by the Employee field so that one employee can have many...
0
by: Michal | last post by:
I have troubles with instaling .Net Framework 2.0 (Beta 2 - 2.0.50215). The main instalation went just fine, troubles begin with my attemt to run aspnet_regiss.exe -i. Asp.Net is instaled into IIS...
0
by: JohnIdol | last post by:
VC++6 to VC++2003 - linking troubles -------------------------------------------------------------------------------- Hi All, I successfully ported an application from VC++6 to VS2003. Solved...
1
by: djforsberg | last post by:
Hi, I have a parent details form with a child DataGridView, both bound to a typed dataset. When I want to add a new parent record, I have code that manually inserts child rows into the...
4
by: bhughes2187 | last post by:
I am using access 2003, I am querying the table scarlet using a statement sql1 = "select rpt from scarlet where rpt <> '~' group by rpt" basically, rpt will have values of ~, A, B, C, D. A can...
1
by: Pegasus | last post by:
Good morning, I'm Filippo Battaglia. We're porting Apache STDCXX under Nanodesktop. We are trying to make nd compatible also with C++ and not only with C. Unfortunately, we're finding different...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.