Jump to content

StaticFX

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by StaticFX

  1. the features are stored in a single column in table 1 separated by a comma f_id is the id number in table 2 that corresponds to the feature number, such as if there is a feature in table1 that has a value of 2 then the f_id in table 2 would be 2 i am grabbing the $var from the array set in $feature3 = array($row['f_id']); 1) im not sure why you are pulling row['fid'] as an array... ? its just one field (string? number?) and not an array 2) if #1 is true.. there will be nothing to loop through in feature 3)right... but do you see in your code, you are looping through the $feature3 setting the value into $var.. but you arent using var. does you query return multiple rows? please post a sample of each field that you are using.....
  2. its kinda hard to follow what you are doing without seeing data... how is the list stored in the DB? do you have the features in one field? CSV? etc like this line $feature3 = array($row['f_id']); whats in f_id? then here foreach($feature3 as $var) you arent even using $VAR? something more like this $chkd = ''; //reset it $chkd = (($var==$row['f_id'])?'CHECKED':''); echo '<div class="cbwrapper"><label><input type="checkbox" name="features[]" value="'.$row["f_id"].'" ' . $chkd . '>'.$row["f_name"].', '.$row['f_id'].'</label></div>'; sorry.. its hard without data.
  3. no... INSERT INTO hwkix_comprofiler_plugin (id, NAME, element, TYPE, folder, backend_menu, access, ordering, published, iscore, client_id, checked_out, params) VALUES (501, "Iframe Integration", "iframe", "user", "plug_iframe", "", 0, 100, 1, 1, 0, 0, ""«»); you have «» in your sql.
  4. i have a page set up so we can edit shop items... names, desc, categories, prices etc when you save, it loops through every item and runs update queries on each there are about 45 items right now... PHP Code: [select] if ($mode == 'update') { $result = mysql_query("SELECT * FROM products ORDER BY id"); if($result) { while($row = mysql_fetch_array($result)){ $categories = ''; foreach ($cats as $key => $value) { $pid = $row['id'] . '_' . $key; $categories = $categories . (($_POST[$pid] != '') ? '(' . $row['id'] . ',' . $_POST[$pid] . '),' : ''); } $categories = substr($categories, 0, -1); $name = htmlentities($_POST[$row['id'] . '_name']); $desc = htmlentities($_POST[$row['id'] . '_desc']); $bp = $_POST[$row['id'] . '_base']; $dp = $_POST[$row['id'] . '_deluxe']; $pp = $_POST[$row['id'] . '_premium']; mysql_query("UPDATE products SET name='" . $name . "', description='" . $desc . "',base_price=" . $bp . ",deluxe_price=" . $dp . ",premium_price=" . $pp . " WHERE id=" . $row['id']); mysql_query("DELETE FROM prodcats WHERE prod_id=" . $row['id']); mysql_query("INSERT INTO prodcats (prod_id,cat_id) VALUES " . $categories . ";"); } } while it DOES work.. i wonder if there is a better way. 2 tables.. products that has the id, prices, desc, name, etc and the prodcat which has a list of the product id and category id. so essentially it loop through each item updates, then updates the prodcats table... 45+ times in a row. I can see this failing. Help! thanks!
×
×
  • 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.