I'm trying to created a nested loop/recordset to show data organized on a page. In the past I've compared a cell in a table with a parent number and see if they equal like so (and it works great):
However now what I want to do now is see if the table cell contains a value, for example:PHP Code:WHERE rs_sub.parent_cell = rs_category.id_cell
I'm a PHP newbie and am using Dreamweaver with canned mxp plugins and here is the code I'm trying to get to work:PHP Code:WHERE rs_sub.parent_cell LIKE rs_category.id_cell
Anybody got any ideas how to do this? Thanks.PHP Code:<?php
mysql_select_db($database_pdb_conn, $pdb_conn);
$query_rs_sub_cat = sprintf("SELECT * FROM pdb_cat", $colname_rs_sub_cat);
$rs_sub_cat = mysql_query($query_rs_sub_cat, $pdb_conn) or die(mysql_error());
$row_rs_sub_cat = mysql_fetch_assoc($rs_sub_cat);
$totalRows_rs_sub_cat = mysql_num_rows($rs_sub_cat);
mysql_select_db($database_pdb_conn, $pdb_conn);
$query_rs_sub_news = "SELECT * FROM pdb_sub WHERE url_self LIKE '12345' ";
$rs_sub_news = mysql_query($query_rs_sub_news, $pdb_conn) or die(mysql_error());
$row_rs_sub_news = mysql_fetch_assoc($rs_sub_news);
$totalRows_rs_sub_news = mysql_num_rows($rs_sub_news);
?>
<body>
<?php
do { // horizontal looper
?>
<?php
if ($totalRows_rs_sub_cat>0) {
$nested_query_rs_sub_news = str_replace("12345", $row_rs_sub_cat['cat_num'], $query_rs_sub_news);
mysql_select_db($database_pdb_conn);
$rs_sub_news = mysql_query($nested_query_rs_sub_news, $pdb_conn) or die(mysql_error());
$row_rs_sub_news = mysql_fetch_assoc($rs_sub_news);
$totalRows_rs_sub_news = mysql_num_rows($rs_sub_news);
$nested_sw = false;
if (isset($row_rs_sub_news) && is_array($row_rs_sub_news)) {
do { //Nested repeat
?>
<?php
} while ($row_rs_sub_news = mysql_fetch_assoc($rs_sub_news)); //Nested move next
}
}
?>
<?php
$row_rs_sub_cat = mysql_fetch_assoc($rs_sub_cat);
if (!isset($nested_rs_sub_cat)) {
$nested_rs_sub_cat= 1;
}
if (isset($row_rs_sub_cat) && is_array($row_rs_sub_cat) && $nested_rs_sub_cat++%2==0) {
echo "</tr><tr>";
}
} while ($row_rs_sub_cat); //end horizontal looper
?>
</body>




Bookmarks