Forum Moderators: coopster
I've simplified my loop here:
_____
$result=mysql_query("SELECT * FROM items WHERE userid ='$userid' AND lastname = '$lastname'");
while($row=mysql_fetch_assoc($result)){
echo "ID : $row[id] ";
echo "Expires On (Y/M/D) : $row[date_expired] ";
_____
1. I want to echo the image renew.jpg only where date_expired is less than today' date. In otherwords, the renew button will only show in the loop where the item has expired.
2. I then want the renew.jpg button, if clicked, to add 3 months from today's date to the item's date_expired in the "items" database.
How would I go about doing this inside the loop?
Thank You!
..
$expday = strtotime( $row['date_expired'] ); //will return number of seconds, like time()
$today = time();
if( $today < $expday ) {
echo "<img src='renew.jpg' onclick=' .. ' />"; //whatever else you need
}
..
What I would like to do is have the newdate equal today plus 90 days. Looking forward to your reply.