Jump to content

DELETE from table


The Little Guy

Recommended Posts

That doesn't sound correct.

 

I am trying to make a last viewed items list, that will display your IP's last 10 viewed items. Once the 11th item is added, the oldest item of the ten items is removed, and the second oldest item takes its place, and the 11th item now becomes the 10th item.

 

Yours sounds like it will only allow 1 item then remove it. Yes I am using MySQL (thats why its in the MySQL board).

Link to comment
https://forums.phpfreaks.com/topic/39890-delete-from-table/#findComment-193033
Share on other sites

Why worry about deleting anything past the last 10 IPs?

 

You can keep them all and use something like this to view only the 10 newest:

SELECT * FROM ip_list ORDER BY ip_id DESC LIMIT 10

At least that way if you do need to check for duplicate IPs or anything else then the data is there, it's just that its not being used.

Link to comment
https://forums.phpfreaks.com/topic/39890-delete-from-table/#findComment-193243
Share on other sites

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.