Hii,
i need help in sorting multidimensiana l 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..ui d 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=whi te align=center cellspacing=1 cellpadding=1>" );
print(" <tr bgcolor=#DEE2E6 >");
print("<td><b>N ame</b></td>");
print("<td><b>E mail Id</b></td>");
print("<td><b>R oom Number</b></td>");
print("<td><b>E xtension</b></td>");
print(" </tr>");
$str_sql1="sele ct min(uid) from profile_values where fid=13 and value =''";
$result=mysql_q uery($str_sql1) ;
$thisrow=mysql_ fetch_row($resu lt);
$a=$thisrow[0];
$str_sql2="sele ct max(uid) from profile_values" ;
$result2=mysql_ query($str_sql2 );
$thisrow2=mysql _fetch_row($res ult2);
$b=$thisrow2[0];
$str_sql1="sele ct distinct uid from profile_values" ;
$result=mysql_q uery($str_sql1) ;
$thisrow=mysql_ fetch_row($resu lt);
$a=4;
for($l = 0 ; $l <= $b ; $l++)
{
print(" <tr bgcolor=#DEE2E6 >");
$str_sql5="sele ct value from profile_values where uid=$l and fid=13";
$result5=mysql_ query($str_sql5 );
$thisroww=mysql _fetch_row($res ult5);
$str_sql2="sele ct value from profile_values where uid=$l and fid=14";
$result1=mysql_ query($str_sql2 );
$thisrow1=mysql _fetch_row($res ult1);
if($thisrow1[0] == 'Bangalore' and $thisroww[0]==''){
$str_sql3="sele ct value from profile_values where uid=$l and fid=11";
$result3=mysql_ query($str_sql3 );
$thisrow3=mysql _fetch_row($res ult3);
$str_sql7="sele ct value from profile_values where uid=$l and fid=7";
$result7=mysql_ query($str_sql7 );
$thisrow7=mysql _fetch_row($res ult7);
$pos = strpos($thisrow 7[0],'@');
$email = substr($thisrow 7[0], 0, $pos);
$str_sql8="sele ct value from profile_values where uid=$l and fid=17";
$result8=mysql_ query($str_sql8 );
$thisrow8=mysql _fetch_row($res ult8);
$str_sql="selec t * from profile_values where uid=$l and fid=3";
$res_id=mysql_q uery($str_sql);
$i=0;
$Colloquiums = array();
while($sub_row= mysql_fetch_arr ay($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=$Colloquium s[0][uid];
print("<a href='/user/$ID'>");
print_r($Colloq uiums[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_Designa tion | | 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_Supervi sor | | Personal information | | textfield | -2 | 0 | 1 | 2 | 0 | |
| 14 | Location | profile_Locatio n | | 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)
i need help in sorting multidimensiana l 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..ui d 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=whi te align=center cellspacing=1 cellpadding=1>" );
print(" <tr bgcolor=#DEE2E6 >");
print("<td><b>N ame</b></td>");
print("<td><b>E mail Id</b></td>");
print("<td><b>R oom Number</b></td>");
print("<td><b>E xtension</b></td>");
print(" </tr>");
$str_sql1="sele ct min(uid) from profile_values where fid=13 and value =''";
$result=mysql_q uery($str_sql1) ;
$thisrow=mysql_ fetch_row($resu lt);
$a=$thisrow[0];
$str_sql2="sele ct max(uid) from profile_values" ;
$result2=mysql_ query($str_sql2 );
$thisrow2=mysql _fetch_row($res ult2);
$b=$thisrow2[0];
$str_sql1="sele ct distinct uid from profile_values" ;
$result=mysql_q uery($str_sql1) ;
$thisrow=mysql_ fetch_row($resu lt);
$a=4;
for($l = 0 ; $l <= $b ; $l++)
{
print(" <tr bgcolor=#DEE2E6 >");
$str_sql5="sele ct value from profile_values where uid=$l and fid=13";
$result5=mysql_ query($str_sql5 );
$thisroww=mysql _fetch_row($res ult5);
$str_sql2="sele ct value from profile_values where uid=$l and fid=14";
$result1=mysql_ query($str_sql2 );
$thisrow1=mysql _fetch_row($res ult1);
if($thisrow1[0] == 'Bangalore' and $thisroww[0]==''){
$str_sql3="sele ct value from profile_values where uid=$l and fid=11";
$result3=mysql_ query($str_sql3 );
$thisrow3=mysql _fetch_row($res ult3);
$str_sql7="sele ct value from profile_values where uid=$l and fid=7";
$result7=mysql_ query($str_sql7 );
$thisrow7=mysql _fetch_row($res ult7);
$pos = strpos($thisrow 7[0],'@');
$email = substr($thisrow 7[0], 0, $pos);
$str_sql8="sele ct value from profile_values where uid=$l and fid=17";
$result8=mysql_ query($str_sql8 );
$thisrow8=mysql _fetch_row($res ult8);
$str_sql="selec t * from profile_values where uid=$l and fid=3";
$res_id=mysql_q uery($str_sql);
$i=0;
$Colloquiums = array();
while($sub_row= mysql_fetch_arr ay($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=$Colloquium s[0][uid];
print("<a href='/user/$ID'>");
print_r($Colloq uiums[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_Designa tion | | 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_Supervi sor | | Personal information | | textfield | -2 | 0 | 1 | 2 | 0 | |
| 14 | Location | profile_Locatio n | | 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)
Comment