function make_selectlist($current_dept_id, $count, $cmpid) { static $option_results; if (!isset($current_dept_id)) { $current_dept_id = 0; } $count = $count + 1; $sql = "SELECT nDeptId as id, vDeptDesc as name from sptbl_depts where nDeptParent = '{$current_dept_id}' and nCompId={$cmpid} order by name asc"; $get_options = mysql_query($sql); $num_options = mysql_num_rows($get_options); if ($num_options > 0) { while (list($dept_id, $dept_name) = mysql_fetch_row($get_options)) { if ($current_dept_id != 0) { $indent_flag = " "; for ($x = 2; $x <= $count; $x++) { $indent_flag .= "--> "; } } $dept_name = $indent_flag . htmlentities($dept_name); $option_results[$dept_id] = $dept_name; make_selectlist($dept_id, $count, $cmpid); } } return $option_results; }
} } else { if ($_POST["btnDelete"] == "Delete") { $sql = "DELETE FROM " . $tableprefix . "products\n\t\t\tWHERE product_id = '" . addslashes($productid) . "'\n\t\t\t"; mysql_query($sql); $routesql = "Select route from " . $tableprefix . "categories where category_id ='{$ddlCategory}'"; $result = mysql_query($routesql); $row = mysql_fetch_array($result); $route = $row["route"]; $qryupdatecatcount = "update " . $tableprefix . "categories set count=count-1 where category_id in({$route})"; mysql_query($qryupdatecatcount); header("Location:catalog.php?catid={$ddlCategory}"); exit; } } $catlist = make_selectlist(0, 0); $artistlist = makeArtistList(); $sql = "SELECT * FROM " . $tableprefix . "products WHERE product_id= '" . addslashes($productid) . "' "; $result = mysql_query($sql); if (mysql_num_rows($result) != 0) { $row = mysql_fetch_array($result); $txtProductName = $row["product_name"]; $txtProductCode = $row["product_code"]; $txtDescription = $row["product_description"]; $txtPrice = $row["product_price"]; $ddlCategory = $row["product_category"]; $ddlArtist = $row["product_artist_id"]; $imgsmall = $row["product_image_small"]; $imgbig = $row["product_image_big"]; $txtStock = $row["product_stock"]; $txtlength = $row["product_length"];
function make_selectlist($current_dept_id, $count, $cmpid) { static $option_results; if (!isset($current_dept_id)) { $current_dept_id = 0; } if (!isset($cmpid)) { $cmpid = 0; } $count = $count + 1; $sql = "SELECT nDeptId as id, vDeptDesc as name,vDeptMail as email from sptbl_depts where nDeptParent = '{$current_dept_id}' and nCompId={$cmpid} order by name asc "; $get_options = mysql_query($sql); $num_options = mysql_num_rows($get_options); if ($num_options > 0) { while (list($dept_id, $dept_name, $email) = mysql_fetch_row($get_options)) { $dept_name = htmlentities($dept_name); $dept_mail = htmlentities($email); $option_results[$dept_id] = $dept_name . " ({$dept_mail}) "; make_selectlist($dept_id, $count, $cmpid); } } return $option_results; }
function make_selectlist($current_cat_id, $count) { global $tableprefix; static $option_results; if (!isset($current_cat_id)) { $current_cat_id = 0; } $count = $count + 1; $sql = "SELECT category_id as id, category_name as name,gift_certificate_flag\n\t\t FROM " . $tableprefix . "categories WHERE parent_id = '" . addslashes($current_cat_id) . "' ORDER BY name ASC "; $get_options = mysql_query($sql); $num_options = mysql_num_rows($get_options); if ($num_options > 0) { while (list($cat_id, $cat_name, $gift_flag) = mysql_fetch_row($get_options)) { /*-------Multicart 2.0 Upgradation------------*/ if ($gift_flag == "Y") { $select_gift_products = "SELECT product_id FROM " . $tableprefix . "products\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t WHERE product_category = " . $cat_id; $result_gift_products = mysql_query($select_gift_products) or die(mysql_error()); if (mysql_num_rows($result_gift_products) > 0) { if ($current_cat_id != 0) { $indent_flag = "--"; for ($x = 2; $x <= $count; $x++) { $indent_flag .= " --> "; } } $cat_name = $indent_flag . stripslashes($cat_name); $option_results[$cat_id] = stripslashes($cat_name); make_selectlist($cat_id, $count); } } else { if ($current_cat_id != 0) { $indent_flag = "--"; for ($x = 2; $x <= $count; $x++) { $indent_flag .= " --> "; } } $cat_name = $indent_flag . stripslashes($cat_name); $option_results[$cat_id] = stripslashes($cat_name); make_selectlist($cat_id, $count); } } } return $option_results; }