dmschenk Posted July 2, 2007 Share Posted July 2, 2007 I'm having a slight problem with pulling the information from a second table. I can't seem to get it to recognize that the second table is even there. The prodName field in the prodcat table is what I'm trying to get but it doesn't seem to be working. Can someone please show me the light? <?php mysql_select_db($database, $db_srevent); $query = "SELECT products.*, prodcat.prodName FROM products, prodcat WHERE products.idProdCat = prodcat.idProdCat ORDER BY products.idProduct"; $products = mysql_query($query, $db_srevent) or die(mysql_error()); $row = mysql_fetch_assoc($products); $totalRows = mysql_num_rows($products); ?> /********************/ <?php $prod = $prod_cat = ''; while (list($idProduct, $idCategoryType, $idProdCat, $prodDescription, $prodSeatCapacity, $prodTentSize, $prodSize, $prodBasePrice, $prodEachPrice, $prodPackof5, $prodName, $dt,) = mysql_fetch_row($products)){ $dt = ($idCategoryType); if ($prod != $idProdCat){ echo "<br><table border='1' width='900' align='center'><td bgcolor='#E4C6E2'>$idCategoryType / $idProdCat / $prodName</td></tr>\n"; $prod = $idProdCat; } if ($prod_cat != $dt){ echo "<tr><td>$prodDescription / $prodSeatCapacity / $prodTentSize / $prodSize / $prodBasePrice / $prodEachPrice / $prodPackof5</td></tr>\n"; $prod_cat = $dt; } else { echo "<tr><td>$prodDescription / $prodSeatCapacity / $prodTentSize / $prodSize / $prodBasePrice / $prodEachPrice / $prodPackof5</td></tr>\n"; } } echo "</table>\n"; ?> <?php mysql_free_result($products); ?> Thanks Dave Link to comment https://forums.phpfreaks.com/topic/58082-linking-tables-problem/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.