-1
Guys, I need some help.
I have a table where in the price field I need to assess whether the price of the last 3 records were higher than 50. If yes I have to display an alert.
Well catch the last 3 records I could using a select with desc e limit 3. If it were only to display it would be easy the problem is how to evaluate the last 3 records and know if the 3 were greater than 50 or not.
The alert part is also easy, I managing to assess the data I give in echo.
You signaled that it is php, but which is the database server? Which database driver are you using? What is the structure of this price list? Detail plus case attributes for a better answer.
– adrianosmateus
Database: Mysql. Drive I understand you want to know if I am using Mysqli or PDO, if that is the answer is PDO. The table structure would be id, product name and price. What I need to do is just issue an alert when the last 3 products added in the table cost more than 50 afterwards. For example: pen 40, pencil 60, mouse 70. In this case the alert is not issued because only the last 2 products were greater than 50, so nothing happens. However if pen 60 pencils 70 mouse 80 ai would display an alert Congratulations the 3 last products cost more than 50.
– Trunks_SSJ2