Hii,
i need help in sorting multidimensianal array...
i Read the multi sort function cld not use tht so i need help..This is the code.
here the problem is tht i need to take out values from 2 different tables.i am getting the output properly but only thing is tht i need to sort the o/p as per name
here fid=6 is designation..uid is the id of the user ,fid=3 is Name of the person,fid=11 is for extension ,fid=1 is research interest,fid=2 is homepage,fid=7 is email,fid=8 for address,fid=9 for nick name,fid=12 | Thesis Title,fid= 13 | Supervisor ,fid=14 | Location ,fid= 17 | Room Number
[PHP]
<?php
print("<table width=100% border=1 bordercolor=white align=center cellspacing=1 cellpadding=1>");
print(" <tr bgcolor=#DEE2E6>");
print("<td><b>Name</b></td>");
print("<td><b>Email Id</b></td>");
print("<td><b>Room Number</b></td>");
print("<td><b>Extension</b></td>");
print(" </tr>");
$str_sql1="select min(uid) from profile_values where fid=13 and value =''";
$result=mysql_query($str_sql1);
$thisrow=mysql_fetch_row($result);
$a=$thisrow[0];
$str_sql2="select max(uid) from profile_values";
$result2=mysql_query($str_sql2);
$thisrow2=mysql_fetch_row($result2);
$b=$thisrow2[0];
$str_sql1="select distinct uid from profile_values";
$result=mysql_query($str_sql1);
$thisrow=mysql_fetch_row($result);
$a=4;
for($l = 0 ; $l <= $b ; $l++)
{
print(" <tr bgcolor=#DEE2E6>");
$str_sql5="select value from profile_values where uid=$l and fid=13";
$result5=mysql_query($str_sql5);
$thisroww=mysql_fetch_row($result5);
$str_sql2="select value from profile_values where uid=$l and fid=14";
$result1=mysql_query($str_sql2);
$thisrow1=mysql_fetch_row($result1);
if($thisrow1[0] == 'Bangalore' and $thisroww[0]==''){
$str_sql3="select value from profile_values where uid=$l and fid=11";
$result3=mysql_query($str_sql3);
$thisrow3=mysql_fetch_row($result3);
$str_sql7="select value from profile_values where uid=$l and fid=7";
$result7=mysql_query($str_sql7);
$thisrow7=mysql_fetch_row($result7);
$pos = strpos($thisrow7[0],'@');
$email = substr($thisrow7[0], 0, $pos);
$str_sql8="select value from profile_values where uid=$l and fid=17";
$result8=mysql_query($str_sql8);
$thisrow8=mysql_fetch_row($result8);
$str_sql="select * from profile_values where uid=$l and fid=3";
$res_id=mysql_query($str_sql);
$i=0;
$Colloquiums = array();
while($sub_row=mysql_fetch_array($res_id)){
$tmp = array(
'Count' => $i+1,
'fid' => $sub_row['fid'],
'uid' => $sub_row['uid'],
'value' => $sub_row['value']
);
$Colloquiums[$i++]= $tmp;
}
$lcount="$tmp[Count]";
$nj=$lcount-1;
print("<td>");
$ID=$Colloquiums[0][uid];
print("<a href='/user/$ID'>");
print_r($Colloquiums[0][value]);
print("</a>");
print("</td>");
if ($email != ""){
print("<td>");
echo $email;
print("</td>");
}else
{
print("<td>");
echo "-";
}
print("</td>");
print("<td>");
if($thisrow8[0]!=''){
echo $thisrow8[0];
}
else{
echo(" -");
}
print("</td>");
print("<td>");
if($thisrow3[0]!=''){
echo $thisrow3[0];
}
else{
echo(" -");
}
print("</td>");
}
print("</tr>");
}
?>[/PHP]
</table><br><br><br><br><br>
This is how profile_fields table structure looks
mysql> select * from profile_fields;
+-----+-------------------+---------------------+-------------+----------------------+------+-----------+--------+----------+----------+------------+--------------+---------+
| fid | title | name | explanation | category | page | type | weight | required | register | visibility | autocomplete | options |
+-----+-------------------+---------------------+-------------+----------------------+------+-----------+--------+----------+----------+------------+--------------+---------+
| 1 | Research Interest | profile_new | | Personal information | | textarea | -2 | 0 | 1 | 2 | 0 | |
| 2 | Homepage | profile_URL | | Personal information | | url | 5 | 0 | 1 | 2 | 0 | |
| 3 | Name | profile_Name | | Personal information | | textfield | -5 | 1 | 1 | 3 | 0 | |
| 7 | Email | profile_Email | | Personal information | | textfield | -3 | 0 | 1 | 2 | 0 | |
| 6 | Designation | profile_Designation | | Personal information | | textfield | -4 | 0 | 1 | 2 | 0 | |
| 11 | EXT | profile_EXT | | Personal information | | textfield | 0 | 0 | 1 | 2 | 0 | |
| 8 | Address | profile_Address | | Personal information | | textarea | -1 | 0 | 1 | 2 | 0 | |
| 9 | Nick | profile_Nick | | Personal information | | textfield | -5 | 0 | 1 | 2 | 0 | |
| 12 | Thesis Title | profile_Thesis | | Personal information | | textfield | -3 | 0 | 1 | 2 | 0 | |
| 13 | Supervisor | profile_Supervisor | | Personal information | | textfield | -2 | 0 | 1 | 2 | 0 | |
| 14 | Location | profile_Location | | Personal information | | textfield | 5 | 0 | 1 | 2 | 0 | |
| 15 | Staff | profile_Staff | | Personal information | | checkbox | 3 | 0 | 1 | 2 | 0 | |
| 16 | Student | profile_Student | | Personal information | | checkbox | 3 | 0 | 1 | 4 | 0 | |
| 17 | Room Number | profile_room | | Personal information | | textfield | 5 | 0 | 0 | 2 | 0 | |
+-----+-------------------+---------------------+-------------+----------------------+------+-----------+--------+----------+----------+------------+--------------+---------+
14 rows in set (0.01 sec)