I'm a beginner in PHP and MySQL and I'm still in learning process. Is it possible to combine many MySQL statement into one query? This is because I want to display every new output into new row in a table. The coding below is not the right way to display the output like what I want.
<table>
<tr>
<th>Staff Name</th>
<th>Staff No.</th>
<th>Grade</th>
<th>Position</th>
<th>Department</th>
</tr>
<tr>
<?php
$query="select staffName, staffNo from tblstaff";
$result=mysql_query($query) or die (mysql_error());
while($row= mysql_fetch_array($result))
{
?>
<td><?php echo $row['staffName']; ?></td>
<td><?php echo $row['staffNo']; ?></td>
<?php
}
?>
<?php
$query="select grade, gradePosition, gradeDepartment from tblgrade";
$result=mysql_query($query) or die (mysql_error());
while($row= mysql_fetch_array($result))
{
?>
<td><?php echo $row['grade']; ?></td>
<td><?php echo $row['gradePosition']; ?></td>
<td><?php echo $row['gradeDepartment']; ?></td>
<?php
}
?>
</tr>
</table>
The result for the above code is all the staff name and staff no in database table out first and then follow by all grade, position and department in a database table displayed in a row of the table. The output is not sequence accordingly like I want. Can anyone help me to solve my problem?
Thank you in advance.
</div>