"; $age= 365.25*$years+30.4375*$months+$days; //print "age: "; echo ($age); print "
"; $total=14- (int) $age; //echo($total); $updatetable="UPDATE books_table SET `daysleft`= $total WHERE `timeposted`=$d"; mysql_query($updatetable) or die('could not update table'); return $total; } include "connect.php"; //mysql db connection here print ""; print ""; $getthreads="SELECT * from books_table order by `course` ASC"; $getthreads2=mysql_query($getthreads) or die("Could n ot get threads"); while($getthreads3=mysql_fetch_array($getthreads2)) { $getthreads3[postid]=strip_tags($getthreads3[postid]); $getthreads3[usrname]=strip_tags($getthreads3[usrname]); $getthreads3[course]=strip_tags($getthreads3[course]); $getthreads3[book]=strip_tags($getthreads3[book]); $getthreads3[prof]=strip_tags($getthreads3[prof]); $getthreads3[desc]=strip_tags($getthreads3[desc]); $getthreads3[edition]=strip_tags($getthreads3[edition]); $getthreads3[isbn]=strip_tags($getthreads3[isbn]); $getthreads3[price]=strip_tags($getthreads3[price]); $getthreads3[timeposted]=strip_tags($getthreads3[timeposted]); $daysleftoremove=finduration($getthreads3[timeposted]); print ""; $daysleftoremove=null; } print "
ContactPriceCourse TitleBook Title & AuthorProfessorEditionCommentsISBNDays Left
Buy Now!$$getthreads3[price]$getthreads3[course]$getthreads3[book]$getthreads3[prof]$getthreads3[edition]$getthreads3[desc]$getthreads3[isbn]$daysleftoremove
"; $getexpired= "SELECT * FROM books_table WHERE daysleft<=0"; $getexpired2=mysql_query($getexpired) or die ('could not get te expired posts'); while ($getexpired3=mysql_fetch_array($getexpired2)) { $getexpired3[usrname]=strip_tags($getexpired3[usrname]); $getexpired3[book]=strip_tags($getexpired3[book]); $getexpired3[course]=strip_tags($getexpired3[course]); $getexpired3[edition]=strip_tags($getexpired3[edition]); $getexpired3[prof]=strip_tags($getexpired3[prof]); $transferthem="INSERT INTO expired (`usrname`,`course`,`book`,`edition`,`prof`) VALUES ('$getexpired3[usrname]','$getexpired3[course]','$getexpired3[book]','$getexpired3[edition]','$getexpired3[prof]')"; mysql_query($transferthem) or die ('Could not transfer expired posts'); } $cleanoldposts="DELETE FROM books_table WHERE daysleft <= 0"; mysql_query($cleanoldposts) or die ('could not delete old post'); ?>