Help me write a MySQL SELECT statement to grab something I wish to get into a dynamic page.
This is a simple dynamic web page list of parts (about 20) with categories (about 3). It works as you would expect. When the list is formatted as a web page, there is a simple test if the item from the parts list is under a new category. If yes, then print the category title before continuing to print the list.
This works well so far. However I'm missing a functionality I wish to have. I wish my list to print the category name even if there are no parts using under the category.
I've used in_array() function to check if a category is grabbed with my SELECT statement when there are no members; it is not. I thought to reverse the order of the SELECT statement (below), but made no difference.
Two MySQL tables=
list_items (id, item, part_number, doc_url, cat_id)
categories (id, cat_name, cat_desc)
list_items.cat_id relates to categories.id
In my PHP script is this query=
$myResult = mysql_query('SELECT list_items., categories. FROM list_items, categories WHERE list_items.cat_id=categories.id ORDER BY list_items.cat_id', $connectID) or die ("Unable to select from database");
As I said, i reversed the order in this SELECT statement, but it made no difference.