我想刪除重複的一個月MySQL的刪除重複一個月
我想刪除重複的,並顯示出這樣的
這是我的代碼
<?php
include "connect.php";
$query = "select * from mydata";
$result = mysqli_query($con,$query);
while($data = mysqli_fetch_array($result)){
$dbasearray[] = $data['month_data'].",".$data['week_data'].",".$data['total_data'];
}
$s1 = array();
$s2 = array();
$a = array();
$b = array();
echo "<table border='1'>
<tr>
<th>Month</th>
<th>Week</th>
<th>Total</th>
<th>s1</th>
<th>s2</th>
<th>a</th>
<th>b</th>
</tr>
";
foreach ($dbasearray as $index => $datah){
$data = explode(",", $datah);
echo "<tr>";
echo "<td align='center'>".$data[0]."</td>";
echo "<td align='center'>".$data[1]."</td>";
echo "<td align='center'>".$data[2]."</td>";
if($index==0){
echo "<td>".$s1[$index] = $data[2]."</td>";
echo "<td>".$s2[$index] = $data[2]."</td>";
}
else {
echo "<td>".$s1[$index] = 0.1*$data[2]+0.9*$s1[$index-1]."</td>";
echo "<td>".$s2[$index] = 0.1*$s1[$index]+0.9*$s2[$index-1]."</td>";
}
echo "<td>".$a[$index] = 2*$s1[$index]-$s2[$index]."</td>";
echo "<td>".$b[$index] = (0.1/0.9)*($s1[$index]-$s2[$index])."</td>";
echo "</tr>";
}
echo "</table>";
?>
我不知道刪除/隱藏我的代碼,我不能使用 幫助我。感謝的
一旦你固定的,你只需要稍作調整,while循環 – Strawberry
@Strawberry我不知道,在我的大學 –
這個問題,並從模塊教育@Strawberry給我的例子,請:( –