This is my code and the result is wrong. I want to show the results of my first query in first column and results of second query in the 2nd column,but both results go in one (first) column. How can I have like this without changing the query?
/*
username username
username_a_1 username_b_1
username_a_1 username_b_4
username_a_2 username_b_1
username_a_2 username_b_4
username_a_3 username_b_5
username_a_4 username_b_2
username_a_4 username_b_3
username_a_5 username_b_1
username_a_5 username_b_4
*/
<html>
<head></head>
<table border="1" >
<tr>
<th>USERNAME</th>
<th>USERNAME</th>
</tr>
<?php
include'db_connect.php';
$query1='SELECT username FROM contacts_a ';
$query_run1=mysql_query($query1);
$query2="SELECT contacts_a.username,contacts_b.username FROM contacts_a LEFT JOIN contacts_b ON contacts_a.level=contacts_b.level";
$query_run2=mysql_query($query2);
while($query_array1=mysql_fetch_assoc($query_run1)){
foreach($query_array1 as $index => $names){
echo '<tr>
<td>'.(($names == NULL )? 'NULL': $names).'</td>
</tr>';
}//end of foreach
}//end of while
while($query_array2=mysql_fetch_assoc($query_run2)){
foreach($query_array2 as $index => $names){
echo '<tr>
<td>'.(($names == NULL )? 'NULL': $names).'</td>
</tr>';
}//end of foreach
}//end of while
?>
</table>
</html>