خرید بک لینک

Vote count: 0

I am creating an average kilometer run calculator for my system. So I am trying to get the last two date and last two run on my database.

This is my current code:

<?php

$co = mysqli_coect('localhost','root','','mypms');

 $sqldates = "SELECT dateinput FROM sched ORDER BY dateinput DESC LIMIT 2";
 $sqlrun = "SELECT reading FROM sched ORDER BY reading DESC LIMIT 2"; 

 $resultdate = mysql_query($co,$sqldates);
 $resultrun = mysql_query($co,$sqlrun);


 while($rowdate = mysql_fetch_assoc($resultdate))
 {
     this ->
 }

 $date_difference = $date2 - $date1;

 while($rowrun = mysql_fetch_assoc($resultrun))
 {
     this ->
 }

 $run_difference = $run2 - $run1;
 $averagerun = $run_difference/$date_difference

 echo $averagerun;
?>

what should I write on my this so I can store my $resultrun and $resultdate to $date1, $date2 and $run1, $run2.

Note: Datetype of dateinput is date on my mysqldatabase.

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 14 فروردين 1395 ساعت: 6:37

صفحه بندی