close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Database Help

Thread began 8/06/2012 6:37 pm by reiter303441179 | Last modified 9/02/2012 1:20 pm by reiter303441179 | 2938 views | 43 replies

Christopher WestCommunity Expert

Im attaching a simple demostration on selecting a category in a menu and then dynamically displaying all those products for that category on a sepetate page.....

make sure you create a database named dinkydb and import the dinkydb.sql into phpMyAdmin and set up the database in Dreamweaver....

the area of code that are important are:

menu.php for the menu recordset setup
mysql_select_db($database_dinkydb, $dinkydb);
$query_Recordset1 = "SELECT * FROM productcategories ORDER BY CategoryName ASC";
$Recordset1 = mysql_query($query_Recordset1, $dinkydb) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

menu.php to display the categories
<?php do { ?>
<p><a href="products-by-category.php?CatID=<?php echo $row_Recordset1['CategoryID']; ?>"><?php echo $row_Recordset1['CategoryName']; ?></a></p>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

products-by-category.php recordset setup
$colname_rsProducts = "-1";
if (isset($_GET['CatID'])) {
$colname_rsProducts = $_GET['CatID'];
mysql_select_db($database_dinkydb, $dinkydb);
$query_rsProducts = sprintf("SELECT * FROM products WHERE ProductCategoryID = %s", GetSQLValueString($colname_rsProducts, "int"));
$rsProducts = mysql_query($query_rsProducts, $dinkydb) or die(mysql_error());
$row_rsProducts = mysql_fetch_assoc($rsProducts);
$totalRows_rsProducts = mysql_num_rows($rsProducts);

products-by-category.php to display the products for that category

<?php do { ?>
<p><?php echo $row_rsProducts['ProductName']; ?></p>
<?php } while ($row_rsProducts = mysql_fetch_assoc($rsProducts)); ?>



Attached Files

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...