I have a mysql table which stores about 5000 products.
I then query the table and list all products on my website.
-
What “ORDER BY” or other mysql command I should use in order to query the newest added products first?
SELECT * FROM table WHERE my mysql rules ORDER BY newest???
-
In order to keep the product database rather low (having 5000 products means 5000 pages which I think is too much for my shard hosting) I want to delete old product entries, lets say older than 2 months.
Any ideas how to do it?
Do I need a dat field inside my table? -
Do you think 5000 rows in my database and 5000 pages can be handles by a normal wordpress installation?
You’ll need a DateTime column in your table, that will record the time at the moment when the product was recorded in the database. With this DateTime column, you can order your select clause with the newest ones, and delete the older ones.
To order your select clause by date (the newest come first), you can put this clause
To insert a new column in your table, use the follow statement
To delete the older products (2 months), you can edit the follow statement