我正在“php my admin”中建立一个该位置的表,我在第一次点击其中一个“th”的asc时做到了这一点,现在我试图在第二次点击中制作desc..有什么想法吗?
嗯...很多我不记得对不起...
if($order == '' ) {
$order= id;
}
$homework6 = $mysqli->query("SELECT * FROM homework6 WHERE manufacturer_hebrew LIKE '%$x%' order by $order asc");
$rows = $homework6->fetch_all(MYSQLI_ASSOC);
echo '<div >';
echo '<table border= "1" >';
echo '<th colspan="1">'. '<a href="?order=id">x</a>' .'</th>';
echo '<th colspan="1">'. '<a href="?order=manufacturer_hebrew">x</a>' .'</th>';
echo '<th colspan="1">'. '<a href="?order=manufacturer_english">x</a>' .'</th>';
echo '<th colspan="1">'. '<a href="?order=Models_number">x</a>' .'</th>';
echo '<th colspan="1">'. '<a href="?order=made_in">x</a>' .'</th>';
foreach ($rows as $paz)
{ if ($paz['Models_number'] < 2 ) {
$color = "bg-danger";
}
elseif ($paz['Models_number'] < 10){
$color = "bg-warning";
}
elseif ($paz['Models_number'] < 15){
$color = "bg-success";
}
else {$color = "bg-primary";}
echo '<tr class='.$color.'>';
echo '<td >' .$paz['id']. '</td>';
echo '<td>' .$paz['manufacturer_hebrew']. '</td>';
echo '<td>' .$paz['manufacturer_english']. '</td>';
echo '<td>' .$paz['Models_number']. '</td>';
echo '<td >' .$paz['made_in']. '</td>';
echo '</tr>';
}
echo '</table>';
echo '</div>';
现在只是'asc' 工作。
牛魔王的故事
慕森卡