Jump to content

Post displaying out of order....


scout1idf

Recommended Posts

I'm just learning and I have an annoying problem with my blog display......When I delete an entry in my blog (test post, mistake, whatever) then post another entry, it fills in the deleted post's spot.How do I stop that from happening?ex. (after deleting post id# 3 then writing post id# 6, #6 displays out of order in #3's spot.)id# 1id# 2id# 6id# 4id# 5Copy of my table...

CREATE TABLE `testblog` (`id` int(4) NOT NULL auto_increment,`comment` varchar(1000) NOT NULL,`datetime` varchar(65) NOT NULL default '',PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

Thanks in advance......

Link to comment
Share on other sites

MySQL tables have no definite natural "order" - you can sort the entries when you select them using the ORDER BY clause. E.g., by ID descending (we could have done it by date, if your `datetime` field was an integer):

SELECT * FROM testblog ORDER BY id DESC

Link to comment
Share on other sites

MySQL tables have no definite natural "order" - you can sort the entries when you select them using the ORDER BY clause. E.g., by ID descending (we could have done it by date, if your `datetime` field was an integer):
SELECT * FROM testblog ORDER BY id DESC

Thanks for the help, it worked. Now I need to apply it to my actual code and delete my test code. (and decide asc or desc)Thanks again...
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...