Re: can you help to beginner?
| From: | Andrey Hristov | Date: | Thu, 23 Aug 2001 17:16:48 +0000 |
| Subject: | Re: can you help to beginner? | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-11733@lists.php.net to get a copy of this message | ||
<?php
$sql="SELECT * FROM companies as c LEFT JOIN services as s USING(companyid)
ORDER BY c.companyname;";
$res=mysql_query($sql);
if ($res){
$company_name='';
while ($ar=mysql_fetch_assoc($res)){
if ($company_name!=$ar['companyname']) {
$company_name=$ar['companyname'];
echo $company_name."<br>\n";
}
echo "<li>".$ar['services']."</li>";
}
}
mysql_free_result($res);
?>
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
99%
----- Original Message -----
From: "Andrius Jakutis" <andrius@internetmedia.lt>
To: <php-db@lists.php.net>
Sent: Friday, August 24, 2001 5:04 AM
Subject: [PHP-DB] can you help to beginner?
> Hello All,
>
> Maybe you can help me, becouse I was searching for various documentations,
> and it seems too difucult for me, becouse everything is so crowded.
>
> I need to built small html file, where I could get listed companies.
>
> I have two tables in my MYSQL database, companies and services.
> Company table:
> companyid and companyname
>
> services table:
> id companyid services.
>
> So I need simply to get listings like this:
>
> Company name
> services
>
> Company2 name
> Services
>
> etc...
>
> Can you help me? I know that for this example its better to use one table,
> not two, but I am just learning..
>
> Thanks
>
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>