sagisgirl
0
Junior Poster in Training
Recommended Answers
Jump to PostAssuming you access the page every day, you can access those about to expire (2 weeks) and expired with SQL
SELECT * FROM table WHERE DATEDIFF(renewdate, CURDATE()) BETWEEN 0 AND 14 [for about to expire]* SELECT * FROM table WHERE CURDATE() > renewdate [for expired]
*That …
Jump to PostSo? does my idea work for you? Use 'expiry_date' instead of 'renewdate' in my code.
However...
the lifetime for each machines is 2 years.
2010-06-24 to 2013-06-24Isn't that 3 years?
Jump to Post<?php $r = mysql_query($q); $output = ''; if(mysql_num_rows($r)) { while($d = mysql_fetch_assoc($r)) { if($d['diff'] < 0) { $notes = "EXPIRED"; }elseif($d['diff'] <= 14){ $notes = "ALERT"; }else{ $notes = ''; } $output .= "<tr><td>{$d['machine']}</td><td>{$d['received_date']}</td><td>{$d['expiry_date']}</td><td>{$d['consignee']}</td><td>$notes</td></tr>"; } } ?> <table> <thead> <tr> <th>Machine</th> <th>Received Date</th> <th>Expiry Date</th> <th>Consignee</th> <th>Notes</th> …
All 10 Replies
diafol
sagisgirl
0
Junior Poster in Training
diafol
sagisgirl
0
Junior Poster in Training
diafol
sagisgirl
0
Junior Poster in Training
sarathnair
0
Newbie Poster
diafol
gebretsadik
0
Newbie Poster
Dani
4,084
The Queen of DaniWeb
Administrator
Featured Poster
Premium Member
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.