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

Items in multiple categories

Thread began 5/02/2009 3:44 pm by Travis250923 | Last modified 5/02/2009 4:46 pm by Travis250923 | 999 views | 1 replies


Items in multiple categories

I'm trying to allow for items to be in multiple categories but I can only get one product to show on the products page. I have set up a relational table and used dataassist to combine the items table and the itemcategory. I have sorted the recordsets using the following code but it results in only the first itemid in the catlink recordset which is the relational table.

When I echo the itemid in the cat link I get the appropriate ids but when I echo itemid from the items recordset I only get one id repeated several times which means I only get 1 item on the page even though there should several. Any help would be great.

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
return $theValue;

$colname_rsCatLink = "-1";
if (isset($_GET['ItemCatID'])) {
$colname_rsCatLink = (get_magic_quotes_gpc()) ? $_GET['ItemCatID'] : addslashes($_GET['ItemCatID']);
mysql_select_db($database_waConn, $waConn);
$query_rsCatLink = sprintf("SELECT * FROM itemcategorylink WHERE ItemCatID = %s", GetSQLValueString($colname_rsCatLink, "int"));
$rsCatLink = mysql_query($query_rsCatLink, $waConn) or die(mysql_error());
$row_rsCatLink = mysql_fetch_assoc($rsCatLink);
$totalRows_rsCatLink = mysql_num_rows($rsCatLink);

$_GET['IDFORITEMS'] = $row_rsCatLink['ItemID'];

$colname_rsItems = "-1";
if (isset($_GET['IDFORITEMS'])) {
$colname_rsItems = (get_magic_quotes_gpc()) ? $_GET['IDFORITEMS'] : addslashes($_GET['IDFORITEMS']);
mysql_select_db($database_waConn, $waConn);
$query_rsItems = sprintf("SELECT * FROM items WHERE ItemID = %s ORDER BY ItemName ASC", GetSQLValueString($colname_rsItems, "int"));
$rsItems = mysql_query($query_rsItems, $waConn) or die(mysql_error());
$row_rsItems = mysql_fetch_assoc($rsItems);
$totalRows_rsItems = mysql_num_rows($rsItems);

$_GET['TEMPIDFORRS'] = $row_rsItems['ItemOptionsID'];

$MMColParam_rsOptions = "-1";
if (isset($_GET['TEMPIDFORRS'] )) {
$MMColParam_rsOptions = (get_magic_quotes_gpc()) ? $_GET['TEMPIDFORRS'] : addslashes($_GET['TEMPIDFORRS'] );
mysql_select_db($database_waConn, $waConn);
$query_rsOptions = sprintf("SELECT * FROM itemoptions WHERE ItemOptionsID = %s", GetSQLValueString($MMColParam_rsOptions, "int"));
$rsOptions = mysql_query($query_rsOptions, $waConn) or die(mysql_error());
$row_rsOptions = mysql_fetch_assoc($rsOptions);
$totalRows_rsOptions = mysql_num_rows($rsOptions);

mysql_select_db($database_waConn, $waConn);
$query_rsCategories = "SELECT * FROM itemcategory ORDER BY ItemCatName ASC";
$rsCategories = mysql_query($query_rsCategories, $waConn) or die(mysql_error());
$row_rsCategories = mysql_fetch_assoc($rsCategories);
$totalRows_rsCategories = mysql_num_rows($rsCategories);

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...