开发者

SQL - PHPmyadmin - Alter table order by 'id ascending' - Make permanent

开发者 https://www.devze.com 2023-02-16 20:46 出处:网络
If I run this: ALTER TABLE`equipos11a12` ORDER BY`ID` It only happens one time. If I change the ids, it wont change in ascending order.

If I run this:

ALTER TABLE  `equipos11a12` ORDER BY  `ID`

It only happens one time. If I change the ids, it wont change in ascending order.

I have to run the alter table everytime in order开发者_如何学Go for the ids to order.

Here is my php code:

 $query = "SELECT  * FROM equipos11a12";

$result = mysql_query($query);  ?>

while($person = mysql_fetch_array($result)) {

echo " " . $person ["name"] . " "; 


You must add the order by clause to your select query :

$query = "SELECT  * FROM equipos11a12 ORDER BY `ID` ASC"; // ascending order    
$query = "SELECT  * FROM equipos11a12 ORDER BY `ID` DESC"; // descending order
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号