Re: Multiple MySQL Tables --> HTML Tables
| From: | Andrey Hristov | Date: | Mon, 27 Aug 2001 17:29:09 +0000 |
| Subject: | Re: Multiple MySQL Tables --> HTML Tables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-64663@lists.php.net to get a copy of this message | ||
<?php
$res = mysql_query("SELECT sd.state_name,s99.count,s00.count,s01.count
FROM states_data sd
LEFT JOIN states99 s99 USING(state_id)
LEFT JOIN states00 s00 USING(state_id)
LEFT JOIN states01 s01 USING(state_id)
");
while($ar=mysql_fetch_assoc($res)){//look at PHP docs to see if mysql_fetch_assoc is there in your
PHP
foreach ($ar as $k => $v){
$str.=sprintf('|%20s',$v).;
}
echo $str."<br>\n"
}
?>
Hope this make a little help.
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
99%
----- Original Message -----
From: "Mouncef Belcaid" <mouncef@uswest.net>
To: <php-general@lists.php.net>
Sent: Monday, August 27, 2001 7:08 PM
Subject: [PHP] Multiple MySQL Tables --> HTML Tables
> Hi all,
>
> I have a newbie question, I hope somebody can help me out.
>
> I have an HTML form (query.html) that has a drop down menu of all 50
> states and 3 checkboxes of 3 years (1999, 2000 and 2001), I want users
> to be able to select one state and any year(s) they want (they can
> choose one or more years). I have a MySQL DB that has 3 tables, each
> table has data for one year (i.e. states99, states00 and states01).
> I want to be able to have the results.php script connect to the
> database, make a query from multiple tables and display it to an HTML
> table, for example:
> State | 1999 | 2000 | or State | 1999 | 2001
> ----------------------
> AL |23,010|12,567|
> .
> .
> .
>
> Thank you for your time.
>
> Mouncef
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>