![]() |
retrive defrent inserted data from mysql & compaer between it to show the graph
hi every body
I need your help friends I am inserting about 40 item in my database four time weekly , I want to get today insert date & the last inserted data in my php page to compare between them & show the graph I use select twice to get current and previous but the result first and last, my code is like Code:
<?php |
Re: retrive defrent inserted data from mysql & compaer between it to show the graph
Your query already selects none duplicates because your using the DISTINCT keyword. You will not get duplicates using that keyword nor would you if you used UNIQUE. you could just get the last item and the date of today and use php to check the date difference.
get last item using id column Code: SQL
or Code: SQL
the last method requires a proper date data type like DATETIME or TIMESTAMP and does not work on any VARCHAR types. Your array would then have three values year, month, and day which you can use php's built in date function to get these for the current day and subtract the values to see the time elapsed. PHP Code:
if you PHP Code:
Code:
Array ( [0] => 06 [1] => 10 [2] => 2012 )Code: SQL
just giving you options to get todays date with code and compare your last entries date. |
| All times are GMT +5.5. The time now is 17:00. |