Lewis Moore wrote:
> The problem comes when i delete a record using the delete function. After a row has been deleted
> this is fine, and the data is still displayed correctly on the news page. How when i use INSERT
> function again it insert the new item where the last one was deleted.
>
> So if i had three news items, for example
>
> 1
> 2
> 3
>
> and i delete item 2, and then insert a new item for example 4 is it place where 2 was
>
> 1
> 4
> 3
>
> I understand why it is doing this, something to do with the table Index!
This statement is not correct.
> My question is, can you use the INSERT function to insert data below the last row?! no mader what
> the table index is???
You cannot rely on the insertion order when you select records without an ORDER BY clause. The records in a relational table are unordered by definition.
If you want to get output in a certain order, you need an ORDER BY clause. In your case, this could be
ORDER BY the_name_of_the_column_containing_the_number_of_the_news_items ASC
for a 1 -> n ordering, or DESC for a n -> 1 ordering.
But it would be better to include a timestamp in your table, and ORDER according to that.
--
felix
Please use
BBCode to format your messages in this forum.