TheLostGuru Posted June 12, 2007 Share Posted June 12, 2007 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 More sharing options...
The Little Guy Posted June 12, 2007 Share Posted June 12, 2007 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. Link to comment https://forums.phpfreaks.com/topic/55311-solved-database-question/#findComment-273408 Share on other sites More sharing options...
TheLostGuru Posted June 12, 2007 Author Share Posted June 12, 2007 I understand those three. I am using the DELETE. Each row has a unique identifier though that uses auto_increment, so I think it will work to order everything by that and just delete the smallest number. Link to comment https://forums.phpfreaks.com/topic/55311-solved-database-question/#findComment-273443 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.