2013-08-24 71 views

回答

1

使用ORDER BY你查詢的末尾:

$sel = "SELECT * FROM items WHERE mainitem_id='".addslashes($_GET['cate_id'])."' ORDER BY item_no; 
2
$sel = "SELECT * FROM items 
     WHERE mainitem_id='".$_GET['cate_id']."' 
     ORDER BY item_no"; 

但是請注意,你的代碼是vurnerable到SQL注入。請解決這個問題。見here

+0

對不起仍然無法正常工作和我建立由MySQL的所有頁面 – user2424747

0
$cate_id = mysql_real_escape_string($_GET['cate_id']); //or any proper similar function (mysqli recommended) 
$sel = "SELECT * FROM items WHERE mainitem_id='$cate_id' ORDER BY 'item_no'";