Jump to content

dowsun18

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Everything posted by dowsun18

  1. Hi, I'm new to php and am attempting to build a site where the navigation and content is built with query functions. My current tables in my database are Categories, Products, and Variation. So a person chooses a category -> then a product -> then a product page shows variations for that product. The problem I am currently having is after when a person selects a section the previous section selected is reset. So lets a person selects a category the product list is shown, but when a person selects a product, the category is no longer selected in the navigation. Or if someone selects product and sees all the variations, if he selects a variation the product ID is reset. I've tried to comb through the internet for some type of solution. I came across concatenating URL encode, but am not sure if this is the correct solution. I tried concatenating one of my urls with "<a href=\"product_detail.php?cat=" . urlencode($sel_cat["id"]) . '&' . "product=" . urlencode($sel_product['id']) . '&' . "var=" . urlencode($var["id"]) . "\" its a bit of a stab in the dark. My $_GET function is function find_selected_product() { global $sel_cat; global $sel_product; global $sel_var; if (isset($_GET['cat'])) { $sel_cat = get_cat_by_id($_GET['cat']); } elseif (isset($_GET['product'])) { $sel_cat = NULL; $sel_product = get_product_by_id($_GET['product']); } elseif (isset($_GET['product'])) { $sel_product = get_product_by_id($_GET['product']); $sel_var = get_default_var($sel_product['id']); } elseif (isset($_GET['var'])) { $sel_product = NULL; //test $sel_var = get_variation_by_id($_GET['var']); } else { $sel_cat = NULL; $sel_product = NULL; $sel_var = NULL; } } My navigation code is function public_navigation($sel_cat, $public = true) { $output = "<td class=\"c1\"><div class=\"sidenav\"><ul>"; $cat_set = get_all_cats($public); while ($cat = mysql_fetch_array($cat_set)) { $output .= "<li>"; if ($cat["id"] == $sel_cat['id']) { $output .= "<a class=\"current\""; } $output .= "<a href=\"index.php?cat=" . urlencode($cat["id"]) . "\">{$cat["cat_name"]}</a></li>"; } $output .= "</ul>"; return $output; } My product is divided into gender and is written like function cat_content_ladies($sel_cat, $sel_product, $female = true) { $output = "<ul class=\"regions\">"; $cat_set = get_all_cats($female); while ($cat = mysql_fetch_array($cat_set)) { if ($cat["id"] == $sel_cat['id']) { $product_set = get_products_for_female($cat["id"], $female); $output .= "<tr>"; while ($product = mysql_fetch_array($product_set)) { if ($cat["id"] == $sel_cat['id']) { $output .= "<tr>"; $output .= "<div class=\"pre\"><a href=\"product_detail.php?product=" . urlencode($product["id"]) . "\"></li>"; $output .= "<img src=\"{$product["img_src"]}\" height=\"121\" width=\"121\">"; $output .= "<div>{$product["prod_name"]}</a></div>"; } } $output .= "</tr>"; } } return $output; } My variation table is set up in thumb nails and is written in this function function show_thumb($sel_product, $sel_var, $public = true) { $output = "<ul class=\"subjects\">"; $product_set = get_all_products($public); while ($product = mysql_fetch_array($product_set)) { $output .= "<li"; if ($product["id"] == $sel_product['id']) { $output .= " class=\"selected\""; } //$output .= "><a href=\"product_detail.php?product=" . urlencode($product["id"]) . //"\">{$product["id"]}</a></li>"; if ($product["id"] == $sel_product['id']) { $var_set = get_variations_for_product($product["id"], $public); $output .= "<ul class=\"pages\">"; while ($var = mysql_fetch_array($var_set)) { $output .= "<li"; if ($var["id"] == $sel_var['id']) { $output .= " class=\"selected\""; } $output .= "><a href=\"product_detail.php?var=" . urlencode($var["id"]) . "\">{$var["id"]}</a></li>"; } $output .= "</ul>"; } } $output .= "</ul>"; return $output; } any light on this subject would be greatly appreciated.
  2. is there a specific reason why I shouldn't have multiple entries in a single cell? I ended up copying and pasting a bullet from MS word and entering them at the beginning of each feature. I set the column utf8_general_ci and the bullets show fine but now I have the problem of mysql killing the white space. This makes me wonder how to deal with indents, multiple paragraphs and general paragraphing styles. Or is it not possible, answering my first question?
  3. I currently have a table with a description column for each product. If my description cell has a number of features can I have them bulleted? example one of my current cell has this info Premium Canadian Origin White Duck Down For Ultimate Warmth DWR (Durable Water Repellent) Coated 100% Polyester Crosshatch Shell Monolithic Membrane Laminated Critically Seam Sealed Construction Windproof Waterproof (10,000mm) Breathable (10,000mm) Outer Shell I know how to list them in bullets if I put them in different cells with <li> tags. Can I somehow get a single cell to bullet through php?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.