I am using Dreamweaver MX and I am having trouble linking three MySQL tables. My code is as follows:
if (isset($HTTP_GET_VARS['subcat_id'])) {
$colname_SubCategory = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['subcat_id'] : addslashes($HTTP_GET_VARS['subcat_id']);
}
mysql_select_db($database_iserver, $iserver);
$query_SubCategory = sprintf("SELECT * FROM category, subcats, topics WHERE category.cat_id = subcats.cat_id AND subcats.subcat_id = topics.subcat_id AND %s = subcat_id", $colname_SubCategory);
The trouble i'm having is that the same subcat is being returned for each subcat_id (where subcat is a field in my subcats table).
That is to say that...
../subcat.php?subcat_id=1
../subcat.php?subcat_id=2
../subcat.php?subcat_id=3
are all returning the same subcat from the database.
Everything else seems to be working fine. Can anyone tell me where I'm going wrong?
Thankyou in advance...
Rachel
if (isset($HTTP_GET_VARS['subcat_id'])) {
$colname_SubCategory = (get_magic_quotes_gpc()) ? $HTTP_GET_VARS['subcat_id'] : addslashes($HTTP_GET_VARS['subcat_id']);
}
mysql_select_db($database_iserver, $iserver);
$query_SubCategory = sprintf("SELECT * FROM category, subcats, topics WHERE category.cat_id = subcats.cat_id AND subcats.subcat_id = topics.subcat_id AND %s = subcat_id", $colname_SubCategory);
The trouble i'm having is that the same subcat is being returned for each subcat_id (where subcat is a field in my subcats table).
That is to say that...
../subcat.php?subcat_id=1
../subcat.php?subcat_id=2
../subcat.php?subcat_id=3
are all returning the same subcat from the database.
Everything else seems to be working fine. Can anyone tell me where I'm going wrong?
Thankyou in advance...
Rachel