Hello everybody!
There is a problem with my db table. For example i send 6 posts (with title, author and content) to the db table one after an other, so their post's id would be 1-2-3-4-5-6.
Then if i delete the post number 6 and then write a new post (which it's id must be 7), after that when i echo all posts on the page to see them, i see posts with ids 1-2-3-4-5-7 !!
How can i solve this problem? When i delete the post with id 6, the next post should be set there into id 6.
Niloofar24 15 Posting Whiz
Recommended Answers
Jump to PostAuto incrementing ids work this way by design. If you want more control then use a column you can explicitly control.
Jump to PostSupporting @DaveAmour's comment. You probably set the id field into auto incrementing. What you should do to your work is don't display the ids to users and instead, display an index.
$index = 1; foreach($result as $row){ echo "<tr class='tr'><td>" . $index . "</td><td> <a href='single-post-page.php?post=" . …
All 5 Replies
DaveAmour 160 Mmmmmm beer Featured Poster
lps 71 Posting Pro in Training
Niloofar24 15 Posting Whiz
lps 71 Posting Pro in Training
DJBirdi 54 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.