Jump to content

309saurabhd

Members
  • Posts

    2
  • Joined

  • Last visited

Posts posted by 309saurabhd

  1. mysql_query does not return a value from a column, it returns a result set. You should look at the manual page for it. Even better, you should notice the giant red warning on the manual page for mysql_query about how you shouldn't use it any more, and switch your code to use PDO instead of the mysql extension.

    can you please provide the link?

  2. 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...