Question about Inserting into a MySQL Table


#1

Hi there,

Occasionally, I seem to have a strange problem when I try to insert rows into a MySQL table. Sometimes a row is not appended at the end of the table; instead it is inserted at a random position. Moreover, this is pretty much guaranteed to happen whenever I delete a row through the phpMyAdmin interface.

I’ve programmed a message board, and as you can imagine, this random insertion can be very troublesome. Does anyone have any suggestion as to what can be done?

Thank you for your time.


#2

You are simply mistaken about how databases store data. They don’t necessarily sort it by date. I would advise you store the unix timestamp as a field in the table, and sort by that.


#3

check ou the SQL keywords ORDER BY and/ or GROUP BY.

Relational Databases are designed so that the insert and retreival of data is done “randomly”. It is part of what makes it a Relational Databases.