Jump to content

[SOLVED] Database question


TheLostGuru

Recommended Posts

I guess I don't really understand how a database works.  The way it works is fairly simple, at least the way I want it to work is fairly simple.  The database can have an unlimited amount of rows, but it's first column is called 'oid' and only five rows can have the same 'oid'.  If there are more than that, it is supposed to kick the last one, and enter in the new one.  Something like so

 

[abc123, blah blah]

[abc123, blah2 blah2]

[abc123, blah3 blah3]

[abc123, blah4 blah4]

[def789, blah blah]

[abc123, blah5 bla5]

 

So now if I submit something with the oid value as 'abc123' it should kick out the oldest row.  When I manually insert stuff into the database, it puts the new row at the bottom, but when I have tried it using PHP, it puts it at the top?  So my question is, when you insert a new row using PHP, does it put it at the top or the bottom?  And is there a way to control this?

Link to comment
https://forums.phpfreaks.com/topic/55311-solved-database-question/
Share on other sites

There are 3 Common database methods:

INSERT

DELETE

UPDATE

 

By look at those, you should know what each one does.

 

A database will NEVER kick out the oldest row, unless you use the method DELETE, but then you will also need a datetime row as well which will hold the date and time the row was added, then you can DELETE the oldest rows when ever you need too.

 

It places it at the bottom, but you can retrieve rows in almost any order you would like.

Archived

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

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.