More php help

Hello,
I am working on a prototype page for a client and I dont know php very well. I am looking for help with two things:

  1. Can I have multiple $query to differerant tables in my DB? Like
    $query = “SELECT * FROM $usertable WHERE $yourgroupid = $g ORDER BY $yourid DESC”;
    $query2 = "SELECT * FROM $usertable2 WHERE $yourgroupid = $u ";

  2. In regards to the sample below, can someone give me a few pointers on how to script this better? I end up with these really really long echo blocks and it seems very long winded. Also, I dont know how to bring in data from multiple tables. If you look at question 1 above, how would I bring in data from $query2.

Thanks in advance

$result = mysql_query($query);
if($result)
{
while($row = mysql_fetch_array($result))
{
$id = $row["$yourid"];

echo “<div >”;
echo $id;
echo “</div >”;

and so on…