Setting Up a while Loop But NEED HELP!

Hi, I am trying to write a script where I have a list of Categories Listing A-Z

I created the database for it already.
Database = Category
Tables/Fields = id, name

All the names are Misc and A-Z

And I have another Database called Titles

Tables/Fields = id, cat_id, name

for the Cat_id i made them what ever number the letter of the category is… EXAMPLE

DB - Category / Field - Name -’ A’ = id - 2

so on the Title Database I put the titles that start with A with the cat_id of 2 EXAMPLE

DB-Titles - cat_id = 2, Name = Apple, Angry, Agree etc…

Can anyone help me get started to how i should link the two database to print a While Loop

I know how to get the categories to print

$catlist = “SELECT * FROM categories”;
$catres = mysql_query($catlist);

while ($cat = mysql_fetch_assoc($catres))
{

 echo "Categories" .  $cat['name'];

}

^ Example of doing the while loop

But I want the Categories to print out as well as the titles on the Titles Database under the correct header

EXAMPLE

A
Apple
Angry
Agree

PLEASE ELP

Sponsor our Newsletter | Privacy Policy | Terms of Service