Jump to content

piznac

Members
  • Posts

    261
  • Joined

  • Last visited

Everything posted by piznac

  1. Yeah I did a echo on that earlier,.. and its good,.. <?php case "up_nmulti"; if(!isset($_POST['multi']) && $_POST['multi'] != "t"){ $num = $_GET['num']; $item_num = $_POST['item_num']; $item_desc = $_POST['item_desc']; $item_qty = $_POST['item_qty']; $emb_loc1 = $_POST['emb_loc1']; $size = $_POST['size']; $artwork = $_POST['artwork']; $num2 = $_POST['num2']; require_once("/var/www/html/include/classes/confirm.inc.php"); $this = new Confirm(); $this->insert_rows($item_num,$item_desc,$item_qty,$emb_loc1,$num,$size,$artwork,$num2); $this->dis_order($num); }else{ $num = $_GET['num']; $item_num = $_POST['item_num']; $item_desc = $_POST['item_desc']; $item_qty = $_POST['item_qty']; $emb_loc1 = $_POST['emb_loc1']; $size = $_POST['size']; $artwork1 = $_POST['artwork1']; $emb_loc2 = $_POST['emb_loc2']; $artwork2 = $_POST['artwork2']; $emb_loc3 = $_POST['emb_loc3']; $artwork3 = $_POST['artwork3']; $emb_loc4 = $_POST['emb_loc4']; $artwork4 = $_POST['artwork4']; $emb_loc5 = $_POST['emb_loc5']; $artwork5 = $_POST['artwork5']; $subnum = $_POST['subnum']; require_once("/var/www/html/include/classes/confirm.inc.php"); $this = new Confirm(); $this->insert_multi($item_num,$item_desc,$item_qty,$emb_loc1,$num,$size,$artwork1,$emb_loc2,$artwork2,$emb_loc3,$artwork3,$emb_loc4,$artwork4,$emb_loc5,$artwork5,$subnum); $this->dis_order($num); } break; ?>
  2. It's passed via a post var,...from the form associated with this. I can post the form code if that will help.
  3. Ok now the first one is doing the same,. lol... bumpty bump bump
  4. Try this: <?php $num = 43.564243; $rounded = round($num,2); echo $rounded; ?>
  5. Hello again guys,... I have wrote this function to cycle through an unlimitied amount of sql updates(with a bit of help ages ok from a member here): <?php //insert secondary order info function insert_rows($item_num,$item_desc,$item_qty,$emb_loc1,$num,$size,$artwork,$num2){ $flds = array( 'item_num' , 'item_desc' , 'item_qty' , 'emb_loc1', 'num', 'size', 'artwork'); for($i=0;$i<count($item_num);$i++) { $qtmp = array(); foreach($flds as $fld) if (trim(stripslashes($_POST[$fld][$i])) != '') $qtmp[] = $fld . " = '" . mysql_escape_string(trim(stripslashes($_POST[$fld][$i]))) . "'"; foreach($num2 as $num3){ $q = "UPDATE c_or_details SET " . implode(', ',$qtmp) . " WHERE `subitemnum` = '$num3'"; $rs = mysql_query($q) or die ('Problem with 1 the query: ' . $q . '<br>' . mysql_error()); } } } ?> So everything is working fine with this,.. so I decided to do it again with this: <?php //insert multi locations into database function insert_multi($item_num,$item_desc,$item_qty,$emb_loc1,$num,$size,$artwork1,$emb_loc2,$artwork2,$emb_loc3,$artwork3,$emb_loc4,$artwork4,$emb_loc5,$artwork5,$subnum){ $flds = array( 'item_num', 'item_desc', 'emb_loc1', 'artwork1', 'emb_loc2', 'artwork2', 'emb_loc3', 'artwork3', 'emb_loc4', 'artwork4', 'emb_loc5', 'artwork5', 'size', 'item_qty', 'num'); for($i=0;$i<count($item_num);$i++) { $qtmp = array(); foreach($flds as $fld) if (trim(stripslashes($_POST[$fld][$i])) != '') $qtmp[] = $fld . " = '" . mysql_escape_string(trim(stripslashes($_POST[$fld][$i]))) . "'"; foreach($subnum as $sub){ $q = "UPDATE loc_logo_ex SET " . implode(', ',$qtmp) . " WHERE `subnum` = '$sub'"; $rs = mysql_query($q) or die ('Problem with 1 the query: ' . $q . '<br>' . mysql_error()); echo "$q<br /> <br />"; } } } ?> This one though is double looping everything. Meaning that if thier are two records to update it runs the query 4 times and ends up with the wrong data. When run with two changes,.. eg $item_num = 1 & in the 2nd query $item_num = 4,.. this is what the output is: UPDATE loc_logo_ex SET item_num = '1', item_desc = '1', emb_loc1 = 'NA', artwork1 = 'NA', emb_loc2 = 'NA', artwork2 = 'NA', emb_loc3 = 'NA', artwork3 = 'NA', emb_loc4 = 'NA', artwork4 = 'NA', emb_loc5 = 'NA', artwork5 = 'NA', size = 'ONE SIZE', item_qty = '1' WHERE `subnum` = '23' UPDATE loc_logo_ex SET item_num = '1', item_desc = '1', emb_loc1 = 'NA', artwork1 = 'NA', emb_loc2 = 'NA', artwork2 = 'NA', emb_loc3 = 'NA', artwork3 = 'NA', emb_loc4 = 'NA', artwork4 = 'NA', emb_loc5 = 'NA', artwork5 = 'NA', size = 'ONE SIZE', item_qty = '1' WHERE `subnum` = '24' UPDATE loc_logo_ex SET item_num = '4', item_desc = '1', emb_loc1 = 'NA', artwork1 = 'NA', emb_loc2 = 'NA', artwork2 = 'NA', emb_loc3 = 'NA', artwork3 = 'NA', emb_loc4 = 'NA', artwork4 = 'NA', emb_loc5 = 'NA', artwork5 = 'NA', size = 'ONE SIZE', item_qty = '1' WHERE `subnum` = '23' UPDATE loc_logo_ex SET item_num = '4', item_desc = '1', emb_loc1 = 'NA', artwork1 = 'NA', emb_loc2 = 'NA', artwork2 = 'NA', emb_loc3 = 'NA', artwork3 = 'NA', emb_loc4 = 'NA', artwork4 = 'NA', emb_loc5 = 'NA', artwork5 = 'NA', size = 'ONE SIZE', item_qty = '1' WHERE `subnum` = '24' ??
  6. I would look into AJAX,.. using it to make your http calls to php....
  7. Well this is a mysql function,.. hmmm you might want to look it up and see if there is something for mssql,.. not sure. Sorry I couldnt help.
  8. Ohhhh Im sorry,. my bad,.. sum() is a sql function,. not a php one. So you would need to do it in your sql statement: Example: $query = "SELECT type, SUM(price) FROM products GROUP BY type"; echo $row['SUM(price)']; Does that make sense?
  9. hmm,.. well when you echo $RESULT[CONSIDER] in the while loop does it return the numbers?
  10. Ok yeah just do this: $total = sum($RESULT[CONSIDER]); echo $total; that should work.
  11. I would love to know some details on this as well.
  12. ohh,.. like add as in math? try sum($RESULT[CONSIDER]);
  13. <textarea name="body" id="body" cols="50" rows="15" readonly>'.$_CONFIG['MAIL_BODY'].'</textarea> That might work Yeah I just tested it works,.. but if you wanted to be xhtml compliant you would need to make it readonly="readonly" I think.
  14. I have no idea what you are asking.
  15. Well call it a fear,.. I dont like to see my data transfered in the URL if I can help it
  16. Why wouldnt you just use the post method? Then instead of using $_GET['some_stuff'] use $_POST['some_stuff'],... seems more secure to me that way.
  17. Ok let me try to simplify this,.. Im grabbing a query from my database to show orders taken,.. it will look something like this: row 1 - 1.name 2.blah 3.blah etc,... 6.(this has to be a drop down,.. populated from another table) row 2 - 1.name 2.blah 3.blah etc,... 6.(this has to be a drop down,.. populated from another table) etc...... In theory what I need to do is a while loop inside a while loop: <?php while ($mo_details_row = mysql_fetch_assoc($mo_details)){ echo "1.$mo_details_row[1]"; echo "2.$mo_details_row[2]"; echo "3.$mo_details_row[3]"; etc,.. echo "6. <select size=\"1\" name=\"art[]\">"; while ($art_row = mysql_fetch_assoc($art)){ <option>$art_row[path]</option> } echo "</select>"; } ?> Does that make more sense? I hope so cause Im stuck (BTW if I have bumped this too many times,.. sorry
  18. Can you post the code for the form where this data is drawn from?
  19. First are you getting any errors? Anytime you deal with sql you should show erros to see what the problem may be eg: # connect to MySQL $conn = @mysql_connect("localhost","ajdref","ref2") or die ("sorry - could not wont connect to MySQL" . mysql_error()); What is it doing?
  20. anyone?.. Or am I being to confusing?
  21. If I leave out the foreach loop I can get it to work for the first row,.. but not the others. This why I included the foreach,.. but I dont think Im using it properly.
  22. Ok,.. I always get confused when it comes to this. Im pulling some data from a db with the intentions of letting the user edit it. I start with a do while loop to get the data. Inside that is a listing of "artwork" chossen for each line. What I need to do is show (in a drop down box) the list of all available artwork (in another table in db) to the customer. Or all the ones they have uploaded so they can change which one goes with which. I have tried a while loop inside the main while loop and a for each loop inside the main loop. Niether has worked for me,.. possibly becuase it has me confused,.. anywho here is the code,.. any help would be appreciated. Oh and Im not getting an error,.. it is simply not displaying the rest of the items. <?php //function to change items ordered(form) function ch_or_items_form($num){ //query for single location details $mo_details_query = "SELECT * FROM `c_or_details` WHERE `num` = '$num'"; $mo_details = mysql_query($mo_details_query) or die ("c_order_details error:" . mysql_error()); $mo_details_row = mysql_fetch_assoc($mo_details); $mo_details_row_num = mysql_num_rows($mo_details); //query for multi location details if($mo_details_row_num == 0){ $m_details_query = "SELECT * FROM `loc_logo_ex` WHERE `num` = '$num'"; $m_details = mysql_query($m_details_query) or die ("c_order_details error:" . mysql_error()); $m_details_row = mysql_fetch_assoc($m_details); $m_details_row_num = mysql_num_rows($m_details); } /*query for artwork $im_query = "SELECT * FROM `or_logo` WHERE `num` = '$num' GROUP BY `path`"; $im = mysql_query($im_query) or die ("Images error:" . mysql_error()); $im_rows = mysql_fetch_assoc($im); $im_rows_num = mysql_num_rows($im);*/ //query for artwork $sql_art = "SELECT * FROM `or_logo` WHERE `c_name` = '$_SESSION[MM_Username]' GROUP BY `path` ORDER BY `num` DESC"; $art = mysql_query($sql_art) or die ("Artwork error:" . mysql_error()); $art_row = mysql_fetch_assoc($art); $totalRows_art = mysql_num_rows($art); echo "<form action=\"confirm.php?action=&num=$num\" method=\"POST\" name=\"items_form\">"; echo "<table align=\"center\" class=\"log\" bgcolor=\"E5E5E5\" cellspacing=\"0\">"; //figure out which type we have,. multi or not if($mo_details_row_num != 0){ echo "<tr><td><b> Item#</b></td><td><b>Item Description</b></td><td><b>Quanity</b></td><td><b>Size</b></td><td><b>Emb Location</b></td><td><b>ArtWork</b></td></tr>"; do{ echo "<tr><td> <input type=\"text\" size=\"5\" name=\"num[]\" value=\"$mo_details_row[item_num]\" /></td> <td><input type=\"text\" size=\"15\" name=\"desc[]\" value=\"$mo_details_row[item_desc]\" /></td> <td><input type=\"text\" size=\"5\" name=\"qty[]\" value=\"$mo_details_row[item_qty]\"</td> <td><select size=\"1\" name=\"size[]\"> <option selected=\"selected\">$mo_details_row[size]</option> <option>ONE SIZE</option> <option>XS</option> <option>S</option> <option>M</option> <option>L</option> <option>XL</option> <option>2XL</option> <option>3XL</option> <option>4XL</option> <option>1X</option> <option>2X</option> <option>3X</option> <option>4X</option> <option>5X</option> <option>6X</option> <option>YXS</option> <option>YS</option> <option>YM</option> <option>YL</option> <option>YXL</option> <option>6M</option> <option>12M</option> <option>T2</option> <option>T4</option> <option>XXL</option> <option>XXXL</option> <option>XXXXL</option> <option>XXXXXL</option> <option>XXXXXXL</option> <option>OSFM</option> <option>OSFA</option> <option>1XL</option> <option>SMALL</option> <option>MEDIUM</option> <option>LARGE</option> <option>5XL</option> <option>0</option> <option>0-6M</option> <option>12-18M</option> <option>18-24M</option> <option>2</option> <option>2T</option> <option>3-6M</option> <option>3T</option> <option>4</option> <option>4T</option> <option>6</option> <option>6-12M</option> <option>8</option> <option>L-XL</option> <option>Plus2X</option> <option>Plus3X</option> <option>Plus4X</option> <option>S-M</option> <option>XXS</option> <option>10-12Y</option> <option>14-16</option> <option>18-20</option> <option>18M</option> <option>24M</option> <option>2XG</option> <option>5-6Y</option> <option>6-8Y</option> <option>7Y</option> <option>AO</option> <option>2XL-3XL</option> <option>6XL</option> <option>Plus1X</option> <option>W27</option> <option>W28</option> <option>W29</option> <option>W30</option> <option>W31</option> <option>W32</option> <option>W33</option> <option>W34</option> <option>W35</option> <option>W36</option> <option>W37</option> <option>W38</option> <option>W40</option> <option>W42</option> <option>W44</option> <option>W46</option> <option>W48</option> <option>W50</option> <option>W52</option> <option>W54</option> <option>W56</option> <option>W58</option> <option>W60</option> </select></td> <td><select size=\"1\" name=\"emb_loc1[]\"> <option selected=\"selected\">$mo_details_row[emb_loc1] </option> <option>Left Chest</option> <option>Right Chest</option> <option>Center Chest</option> <option>Left Sleeve</option> <option>Right Sleeve</option> <option>Left Cuff(Long Sleeve)</option> <option>Right Cuff(Long SLeeve)</option> <option>Shirt Back Full</option> <option>Shirt Back Yoke</option> <option>Front Hat</option> <option>Hat Back</option> <option>Left Side Hat</option> <option>Right Side Hat</option> <option>Bag Center Flap</option> <option>Bag Center Of Pocket</option> <option>End Of Bag</option> <option>Center</option> <option>Top Center</option> <option>Top Left</option> <option>Top Right</option> <option>Bottom Center</option> <option>Bottom Left</option> <option>Bottom Right</option> <option>Other(See Work Order)</option> </select></td> <td>"; echo "<select size=\"1\" name=\"art[]\">"; echo "<option selected=\"selected\">$mo_details_row[artwork]</option>"; $art = implode(",",$art_row[path]); do { foreach($art as $key => $value){ $filename = explode("/", $art_row[path]); $short_filename = substr($filename[4],0,10); echo "<option>$short_filename</option>"; } }while ($art_row = mysql_fetch_assoc($art)); echo "</selected>"; echo "</td></tr>"; }while ($mo_details_row = mysql_fetch_assoc($mo_details)); echo "</table>"; echo "</form>"; } } ?> BTW this final loop is what Im refering to,.. the "foreach": <?php echo "<select size=\"1\" name=\"art[]\">"; echo "<option selected=\"selected\">$mo_details_row[artwork]</option>"; $art = implode(",",$art_row[path]); do { foreach($art as $key => $value){ $filename = explode("/", $art_row[path]); $short_filename = substr($filename[4],0,10); echo "<option>$short_filename</option>"; } }while ($art_row = mysql_fetch_assoc($art)); echo "</selected>"; echo "</td></tr>"; }while ($mo_details_row = mysql_fetch_assoc($mo_details)); echo "</table>"; echo "</form>"; ?>
  23. AHHHHH HA note: Im one of those guys who is hardheaded,..LOL But I figure out a way to do it,.. if I simply pass the php vars into the function,.. in a link it works: <a href=\"javascript:confirmation($nums,'$paths')\" border=\"0\"> <script type="text/javascript"> <!-- function confirmation(num,path) { var answer = confirm("Are you sure you want to delete this artwork?") if (answer){ alert("Entry Deleted") window.location = "confirm.php?action=delart&path="+path+"&num="+num; } else{ alert("No action taken") } } //--> </script> Thanks for the help guys!!
  24. hmmm yeah that seems like a waste just for a confirm box,.. thanks for the help!
  25. OK,.. I see what you are saying,.. is there a way to get the variable to hold the value of the js var?
×
×
  • 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.