function CategorySesion($table, $id_2) { global $id_product, $id_menu; $sqlstr = mysql_query("SELECT id FROM " . $table . " WHERE parent = '" . intval($id_2) . "' "); if (mysql_num_rows($sqlstr) > 0) { while ($row = mysql_fetch_array($sqlstr)) { if ($id_menu == '') { $id_menu = $row['id'] . ',' . intval($id_2); } else { $id_menu .= ',' . $row['id']; } CategorySesion($table, $row['id']); } } $id_menu = $id_menu ? $id_menu : $id_2; return $id_product = $id_menu; }
echo $row['height'] != '0' ? 'height="' . $row['height'] . '"' : ""; ?> /></a></div> <?php } } } mysql_free_result($sqlstr); ?> <table width="98%" border="0" cellspacing="0" cellpadding="0" align="center" style="margin-left:4px;"> <tr> <?php $sqlstr = "SELECT link,picture,height,width FROM " . ads . " WHERE status='true' AND alignment='6' "; if ($id == 'danh-muc' || $id == 'tin-chi-tiet') { CategorySesion(menu_product, $id_1); $sqlstr .= " AND category in (" . $id_product . ")"; } else { $sqlstr .= " AND (category='0' OR category='')"; } $sqlstr .= " ORDER BY stt"; $sqlstr = mysql_query($sqlstr); if (mysql_num_rows($sqlstr) > 0) { $i = 0; while ($row = mysql_fetch_array($sqlstr)) { $i += 1; ?> <td valign="top"> <?php if (preg_match("#swf\$#i", $row['picture'])) { ?>