Displaying results of an array
Posted: Mon Mar 16, 2009 11:29 am
Hi guys, I am trying to display my results as a table, my code is below..
I would like to print the contents of $sid_list and $sid_list1 as a table. Is this possible?
Thank you
Code: Select all
$query1 = "SELECT * FROM Job_ID WHERE Job_Name ='$_SESSION[Job_Name]'";
$result2 = mysql_query($query1)
or die ("Couldn't execute query.");
while ($row2=mysql_fetch_array($result2)){
$Job_ID1=$row2['Job_ID'];
}
////
$sql2="SELECT * FROM ID_Table WHERE Job_ID IN (SELECT Job_ID FROM Job_ID WHERE Job_ID=$Job_ID1)";
$result3 = mysql_query($sql2)
or die ("Couldn't execute query.");
while ($row3=mysql_fetch_array($result3)){
$Skill_Name[]=$row3['Skill_Name'];
$Weight[]=$row3['Weight'];
}
$sep = '';
$sid_list = '';
foreach ($Skill_Name as $sid) {
$sid_list .= "$sep$sid";
$sep = ',';
}
$sid_list .= '';
{
$sep1='';
foreach ($Weight as $wei){
$sid_list1 .= "$sep1$wei";
$sep1=',';
}
$sid_list1 .= '';
}
?>
Thank you