Jump to content

309saurabhd

Members
  • Posts

    2
  • Joined

  • Last visited

309saurabhd's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. I want to develop a library system in which fine will be calculated as follows- the code should be in php and sql database. I want to retrieve date from database and subtract it from current date. The difference will be then multiplied with 5 to know the fine. How can I do this? How can i retrieve date from database and subtract it from current date? returndate is column name from where i want to retrieve date for id=1 and issret is the table name. <form id="form1" name="form1" method="post" action=""><label for="txtDueDate"></label><input type="text" name="DueDate" id="txtDueDate" /><input type="submit" name="submit" id="submit" value="Submit" /></form><?phpif(isset($_POST['submit'])){$result=mysql_query("select returndate from issret where id=1"); if(mysql_num_rows($result)>0){$x=date("Y/m/d");$diff=date_diff($result,$x);echo $diff->format("%R%a days");}}?>
×
×
  • Create New...