使用临时数组的alph顺序

时间:2010-07-22 17:09:32

标签: php html

嘿所有我是新来的,有点新的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'"; 

1 个答案:

答案 0 :(得分:0)

为了按App_FirstApp_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的用途)。