ορίστε το script :
Κώδικας: Επιλογή όλων
<?php
session_start();
include "../connect.php";
$query = mysql_query("SELECT `rank` FROM `members`
WHERE `username` = '$_SESSION[username]'
");
$rank1 = mysql_fetch_array($query)
or die ("Error - Couldn't login user.");
if($rank1[rank] == 2)
{
echo "<form method=\"post\" action=\"statistics.php\">
<select name=\"statistic\">
<option value=\"\">Select Incoming</option>
<option value=\"daily\">Daily Incoming</option>
<option value=\"weekly\">Weekly Incoming</option>
<option value=\"monthly\">Monthly Incoming</option>
</select>
<input type=\"submit\" name=\"submit\" value=\"Click To See Statistics\" /></form><p></p>
";
if ($_POST[statistic]=="daily") {
$sel_date = date('Y-m-d',strtotime('-1 day'));
//echo $sel_date;
}
elseif ($_POST[statistic]=="weekly")
{
$sel_date = date('Y-m-d',strtotime('-1 week'));
//echo $sel_date;
}
else
{
$sel_date = date('Y-m-d',strtotime('-1 month'));
//echo $sel_date;
}
$display_block .= "
<table celpadding=3 cellspacing=2 border=1 width=65%>
<tr>
<th>Order Date</th>
<th>Shipping</th>
<th>Order ID</th>
<th>Payment</th>
</tr>";
$fetch = mysql_query("SELECT * FROM store_orders WHERE order_date > '$sel_date' ");
while ($stat = mysql_fetch_array($fetch)) {
$order_date = $stat[order_date];
$shipping_total = $stat[shipping_total];
$total = $total + $shipping_total;
$order_id = $stat[order_id];
$payment = $stat[payment];
$display_block .= "<tr>
<td align=center>$order_date<br></td>
<td align=center>€ $shipping_total<br></td>
<td align=center>$order_id<br></td>
<td align=center>$payment<br></td>
</tr>";
}
$display_block .= "</table>";
echo $display_block;
echo "<p></p><p align=center><strong><h3>TOTAL SHIPPING $total €</h3></strong></p>";
}
?>