嘿所有我是新来的,有点新的php,我需要通过App_Last以alph顺序创建我的html tage任何帮助都会非常感谢
$query1="SELECT App_Last, App_First
FROM applicant
WHERE (App_Last IS NOT NULL OR App_First IS NOT NULL) AND applicationID='".$r['0']."'
ORDER BY App_First"; echo $query1;
$result1 = mysql_db_query($aidDB, $query1, $connection);
while($r1 = mysql_fetch_array($result1)){
$temp_array1[$y][0]="<option value=\"".$r['0']."\">".$r1['1'].",".$r1['0']."</option>";
$x++;
$y++;
问题是在此之前有一个查询从表中没有nmae字段的其他表中获取$ r ['0']。
$query="SELECT applicationID
FROM app
WHERE schoolID='$id'";
答案 0 :(得分:0)
为了按App_First
和App_Last
排序,您需要的是:
$query1 = 'SELECT App_Last, App_First
FROM applicant
WHERE (App_Last IS NOT NULL OR App_First IS NOT NULL) AND applicationID="'.$r['0'].'"
ORDER BY App_Last ASC, App_First ASC';
我假设您希望结果按App_Last
排序,然后按App_First
排序,并且您希望它们按升序按字母顺序排序(这就是ASC
的用途)。