Link to home
Start Free TrialLog in
Avatar of nyerky
nyerky

asked on

PHP+MySQL and HTML tables

Hello Experts!

I want to create a nice looking table formatted output for this script.

Here's a working script with simple output only:
<?
if($category_db = $db->get_results("select distinct CategoryName from Parts"))
{
   foreach($category_db as $category)
   {
      // SET CATEGORY TITLE
      echo "<B>" . $category->CategoryName . "</B><BR>";

      // LOOP THE PARTS DB
      if($part_db = $db->get_results("SELECT PartName from Parts where
CategoryName='$category->CategoryName'"))
      {
         foreach($part_db as $part)
         {
            // LIST THE PARTS FOR THIS CATEGORY
            echo $part->PartName . "<BR>";
         }
      } else { // DO SOMETHING }                
   }
} else { // DO SOMETHING }

?>

It should be able to adapt hundreds of records and will have a clean table format.  An example output maybe 20 Category Names and 10 0r more Part Names under each Category Name.

Thanks in advance!
:-)
ASKER CERTIFIED SOLUTION
Avatar of venkateshwarr
venkateshwarr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial