if (isset($_POST["from"])) {
$date_from = strtotime( $_POST['from'] );
$date_to = strtotime( $_POST['to'] );
// Format the timestamps to valid MySQL date strings: "YY-MM-DD HH:MM:SS" (in PHP: "Y-m-d H:i:s")
$date_from_mysql = date('Y-m-d 00:00:01', $date_from);
$date_to_mysql = date('Y-m-d 23:59:59', $date_to);
$result = mysql_query("SELECT * FROM binfo_britinfo.newafilcomp WHERE id=$cid LIMIT 1")or die(mysql_error());
$row = mysql_fetch_array($result);
echo "<h4>".$row["cname"]." - Revenue Report (<a href=\"pdf.php?from=".$_POST['from']."&to=".$_POST['to']."&cid=".$cid."\">Generate PDF</a>)</h4>";
echo "<p><b>Date:</b> ".$_POST['from']." - ".$_POST['to']."</p>";
echo "<hr>";
echo '<table width="650" cellpadding="2" cellspacing="0">';
echo '<tr><td width="150"><b>Page</b></td><td width="100"><b>This Month (Clicks)</b></td><td width="100"><b>Earnings</b></td></tr>';
$start = number_format(0, 2, '.', '');
$getcompanies = mysql_query("SELECT aid, COUNT(aid) FROM binfo_britinfo.newafilclick WHERE datetime BETWEEN '".$date_from_mysql."' AND '".$date_to_mysql."' GROUP BY aid ORDER By COUNT(aid) DESC")or die(mysql_error());
while($row = mysql_fetch_assoc($getcompanies))
{
echo '<tr><td><a href="adclicks.php?id='.$row["aid"].'">'.getpgname($row["aid"]).'</a></td><td>'.$row['COUNT(aid)'].'</td><td>?'.earnings($row["aid"],$row['COUNT(aid)']).'</td></tr>';
$num = earnings($row["aid"],$row['COUNT(aid)']);
$total = $start + $num;
$start = $total;
$total = number_format($total, 2, '.', '');
}
echo '<tr colspan="3"><td colspan="3" align="right">Total Earnings: ?'.$total.'</td></tr>';
echo '</table>';
}
else
{
}
This code loads up the clicks from adverts from my database, it works fine if I set any date apart from the 31st of Jan, If i set 1st - 30th jan it loads everything up, if i set it to 1st - 31st jan, it doesn't finish the while loop, the total earnings don't get displayed so i'm guessing it stops before then, any reason why on that date it would just stop?
Question
Domain Beans
if (isset($_POST["from"])) { $date_from = strtotime( $_POST['from'] ); $date_to = strtotime( $_POST['to'] ); // Format the timestamps to valid MySQL date strings: "YY-MM-DD HH:MM:SS" (in PHP: "Y-m-d H:i:s") $date_from_mysql = date('Y-m-d 00:00:01', $date_from); $date_to_mysql = date('Y-m-d 23:59:59', $date_to); $result = mysql_query("SELECT * FROM binfo_britinfo.newafilcomp WHERE id=$cid LIMIT 1")or die(mysql_error()); $row = mysql_fetch_array($result); echo "<h4>".$row["cname"]." - Revenue Report (<a href=\"pdf.php?from=".$_POST['from']."&to=".$_POST['to']."&cid=".$cid."\">Generate PDF</a>)</h4>"; echo "<p><b>Date:</b> ".$_POST['from']." - ".$_POST['to']."</p>"; echo "<hr>"; echo '<table width="650" cellpadding="2" cellspacing="0">'; echo '<tr><td width="150"><b>Page</b></td><td width="100"><b>This Month (Clicks)</b></td><td width="100"><b>Earnings</b></td></tr>'; $start = number_format(0, 2, '.', ''); $getcompanies = mysql_query("SELECT aid, COUNT(aid) FROM binfo_britinfo.newafilclick WHERE datetime BETWEEN '".$date_from_mysql."' AND '".$date_to_mysql."' GROUP BY aid ORDER By COUNT(aid) DESC")or die(mysql_error()); while($row = mysql_fetch_assoc($getcompanies)) { echo '<tr><td><a href="adclicks.php?id='.$row["aid"].'">'.getpgname($row["aid"]).'</a></td><td>'.$row['COUNT(aid)'].'</td><td>?'.earnings($row["aid"],$row['COUNT(aid)']).'</td></tr>'; $num = earnings($row["aid"],$row['COUNT(aid)']); $total = $start + $num; $start = $total; $total = number_format($total, 2, '.', ''); } echo '<tr colspan="3"><td colspan="3" align="right">Total Earnings: ?'.$total.'</td></tr>'; echo '</table>'; } else { }This code loads up the clicks from adverts from my database, it works fine if I set any date apart from the 31st of Jan, If i set 1st - 30th jan it loads everything up, if i set it to 1st - 31st jan, it doesn't finish the while loop, the total earnings don't get displayed so i'm guessing it stops before then, any reason why on that date it would just stop?
Link to comment
Share on other sites
1 answer to this question
Recommended Posts