Hi all, I have seen queries of this nature before, but they never seem to get a thorough answer - and that maybe because the issue isnt explained properly..
okay, so here is the scenario. I have a database which features the following tables: hst_category hst_product hst_category features the following fields and (sample) data: hst_Cat_ID hst_Cat_Name hst_Cat_Desc ---------------------------------------------------------------------------- --- 1 starter Description of this category goes here. blah blah. 2 business Description of business packages would go here. blah. 3 enterprise Description of enterprise packages would be here blah. the idea is to build a query, based in a value passed on the URL to determine which category of product we want. so for example: <? $colname_QRY_hstPkgSummary = "1"; if (isset($HTTP_GET_VARS['category'])) { $colname_QRY_hstPkgSummary = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['category'] : addslashes ($HTTP_GET_VARS['category']); } mysql_select_db($database_DB_hstProducts, $DB_hstProducts); $query_QRY_hstPkgSummary = sprintf("SELECT * FROM hst_categories WHERE hst_Cat_Name = '%s'", $colname_QRY_hstPkgSummary); $QRY_hstPkgSummary = mysql_query($query_QRY_hstPkgSummary, $DB_hstProducts) or die(mysql_error()); $row_QRY_hstPkgSummary = mysql_fetch_assoc($QRY_hstPkgSummary); $totalRows_QRY_hstPkgSummary = mysql_num_rows($QRY_hstPkgSummary); ?> So using the above, if the url featured file.php?category=starter then any the details regarding the category description for "starter" would be returned. We then need to use this information to generate a table further down the page (see below). This table contains information that categorises each of the "products" in the "hst_product" table. (so using the above example, the table would return all products who's product category is "starter" (or 1)) I need to create a HTML table that contains the following: (items with #in front of name will be dynamic, based in the results) +-----------+-------------+--------------+... | | #Product_1 | #Product_2 |... +-----------+-------------+--------------+... | Field 1 | #PID1_fld1 | #PID2_fld1 |... +-----------+-------------+--------------+... | Field 2 | #PID1_fld2 | #PID2_fld2 |... +-----------+-------------+--------------+... | Field 3 | #PID1_fld3 | #PID2_fld3 |... +-----------+-------------+--------------+... any suggestions? I know how to create a row for each product, with the columns for each field, but I want to work the other way. help! Thanks, Matt. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php