开发者

alph order with a temp array

hey all im new here and kind of new to php and i need to create my html tage in alph order by App_Last any help would be great thanks

  $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 $que开发者_如何转开发ry1;

  $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++;

the problem is that before this is have a query that gets $r['0'] from a different table that has no nmae feilds in the table.

$query="SELECT applicationID 
        FROM app
        WHERE schoolID='$id'"; 


In order to have ordering by App_First and App_Last what you want is:

$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';

I'm assuming that you want your results ordered by App_Last and then by App_First and that you want them sorted in ascending, alphabetical order (that's what ASC is for).

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜