# More php help

**URL:** <https://forum.kirupa.com/t/more-php-help/231922>\
**Category:** Uncategorized\
**Created:** [July 9, 2007, 4:56pm UTC](https://forum.kirupa.com/t/more-php-help/231922 "2007-07-09T16:56:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![petermdenton](https://avatars.discourse-cdn.com/v4/letter/p/5daacb/32.png) [@petermdenton](https://forum.kirupa.com/u/petermdenton)\
**Post date:** [July 9, 2007, 4:56pm UTC](https://forum.kirupa.com/t/more-php-help/231922/1 "2007-07-09T16:56:55Z")

</div>

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…
