PHP / multi-dimensional arrays / mysql

  • (2 Pages)
  • +
  • 1
  • 2

26 Replies - 1220 Views - Last Post: 27 May 2013 - 07:49 PM Rate Topic: -----

#16 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,259
  • Joined: 27-December 08

Re: PHP / multi-dimensional arrays / mysql

Posted 24 May 2013 - 04:24 PM

We've already suggested the loop structure. Please read our pervious posts.
Was This Post Helpful? 0
  • +
  • -

#17 pokey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-May 13

Re: PHP / multi-dimensional arrays / mysql

Posted 24 May 2013 - 04:54 PM

View Postmacosxnerd101, on 24 May 2013 - 04:24 PM, said:

We've already suggested the loop structure. Please read our pervious posts.


I am getting frustrated almost to the point of paying someone. :(
Unfortunately most people who answer my questions are making assumptions about my ability.

<?
function mylevel(){ 
$skills = "NOVICE";
echo $skills ;
}
echo "I AM A ";
mylevel();
?>



:)

I know I need to do a loop. My question is still how do I remove the data in the array that I do not need, (see the original array, or how do I fix the form (see original form) so the data is not passed through. The keys and values are not empty so I can not filter them with a simple if "". The only thing empty is the one $value for qty_i which are the values for the other keys_i that I do not want to display. maybe I need a little more detail in an answer to fully get it.

thanks

still not clear and I am sorry for my un-expertise.
Was This Post Helpful? 0
  • +
  • -

#18 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,259
  • Joined: 27-December 08

Re: PHP / multi-dimensional arrays / mysql

Posted 24 May 2013 - 05:02 PM

Quote

My question is still how do I remove the data in the array that I do not need

I don't mean to be rude, but this has been beaten to death. You don't remove elements from $_POST. You just parse out the elements you want. Sample code has already been provided on how to do that. I'm sure you can use an if statement to check if the quantity is greater than 0.

Quote

Unfortunately most people who answer my questions are making assumptions about my ability.

Again, not to be rude, but we're trying to push you in the right direction. Rather than fighting the approaches we're suggesting, try implementing some code. If you get stuck, we're here to help. Really though, make an attempt at this!
Was This Post Helpful? 1
  • +
  • -

#19 Particule42  Icon User is offline

  • New D.I.C Head

Reputation: 3
  • View blog
  • Posts: 13
  • Joined: 24-May 13

Re: PHP / multi-dimensional arrays / mysql

Posted 25 May 2013 - 12:10 AM

Like mentioned you can do a Javascript verification before execute the post,and add PHP verification too to be sure.

Like Dormilich said you can change the structure of your form (the name value of the input fields) like this 'data_1[qty]',data_1[line]', ..., with this you can iterate through the $_POST variable and skip data no qty.
Was This Post Helpful? 0
  • +
  • -

#20 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3524
  • View blog
  • Posts: 12,031
  • Joined: 12-December 12

Re: PHP / multi-dimensional arrays / mysql

Posted 25 May 2013 - 02:50 AM

Quote

I do not know much about php, and I know nothing about javascript

It is hardly surprising that you are struggling with this and, yes, if you know little about php then you may have to pay someone to do this for you. There is a Post a Job area here @DIC.
Was This Post Helpful? 1
  • +
  • -

#21 pokey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-May 13

Re: PHP / multi-dimensional arrays / mysql

Posted 26 May 2013 - 12:15 PM

View PostParticule42, on 24 May 2013 - 08:30 AM, said:

Hi,
I don't know if you already found a solution, but why are you posting fields you don't need.
If you can change your form, you can post only fields you need, fields that have qty.

And if you need a PHP solution, you can use a while loop that start with 1 and end when you don't find a value. Below a fast example:

$i = 1;
while (isset($_POST['qty_' . $i])) {
  if (empty($_POST['qty_' . $i])) {
     continue;
  }
  $qty = $_POST['qty_' . $i];
  $lin = $_POST['lin_' . $i];
  $desc = $_POST['desc_' . $i];
  $ps = $_POST['ps_' . $i];

  // do something with these values here

  $i++;
}



But i think you need to post only what you need. Hope it help.

ps: sorry the bad english ....


Thank you for explaining this. I like this option. however when I try to go through this array
Array ( [qty_3] => Array ( [3] => 20 ) [lin_3] => 3[3] [desc_3] => CHEESE, PARM RMNO BLND GRTD[3] [ps_3] => 2/5 LB[3] [qty_4] => Array ( [4] => 30 ) [lin_4] => 4[4] [desc_4] => CHEESE, PARM GRTD BAG REF IMP[4] [ps_4] => 1/5 LB[4] [qty_5] => Array ( [5] => 50 ) [lin_5] => 5[5] [desc_5] => CHEESE, RMNO HALF WHEEL WAX[5] [ps_5] => 20#[5] [qty_6] => Array ( [6] => ) [lin_6] => 6[6] [desc_6] => BEEF, GRND 81/19 FINE RAW F2F[6] [ps_6] => 4/10LB[6] [qty_7] => Array ( [7] => ) [lin_7] => 7[7] [desc_7] => BEEF, GRND 81/19 FINE RAW REF[7] [ps_7] => 4/10LB[7] [qty_8] => Array ( [8] => ) [lin_8] => 8[8] [desc_8] => TURKEY, BRST WHL MSCL ALL NTRL[8] [ps_8] => 2/8 LBA[8] [qty_9] => Array ( [9] => ) [lin_9] => 9[9] [desc_9] => CHICKEN, BRST STRIP BNLS RSTD[9] [ps_9] => 4/2.5 LB[9] [qty_10] => Array ( [10] => ) [lin_10] => 10[10] [desc_10] => OLIVE, RIPE STD SLCD IMP SPAIN[10] [ps_10] => 6/#10 CN[10] [qty_11] => Array ( [11] => ) [lin_11] => 11[11] [desc_11] => CLAM, OCEAN CKD CHPD CAN SHLF[11] [ps_11] => 12/51 OZ[11] [qty_12] => Array ( [12] => ) [lin_12] => 12[12] [desc_12] => ONION RING BATRD BEER 3/16 [ps_12] => 4/2.5LB[12] [qty_13] => Array ( [13] => ) [lin_13] => 13[13] [desc_13] => TIRAMISU CUP[13] [ps_13] => 12/3.5 OZ[13] [qty_14] => Array ( [14] => ) [lin_14] => 14[14] [desc_14] => GELATO PISTACCHIO[14] [ps_14] => 2/190 OZ[14] [qty_15] => Array ( [15] => ) [lin_15] => 15[15] [desc_15] => GELATO CARMEL SEA SALT[15] [ps_15] => 2/190 OZ[15] [qty_16] => Array ( [16] => ) [lin_16] => 16[16] [desc_16] => GELATO MINT CHOCOLATO CHIP[16] [ps_16] => 2/190 OZ[16] [qty_17] => Array ( [17] => ) [lin_17] => 17[17] [desc_17] => LID TRANS 48 OZ VENTED[17] [ps_17] => 1/500 CT[17] [qty_18] => Array ( [18] => ) [lin_18] => 18[18] [desc_18] => CUP 32 OZ 32MJ48 SQUAT[18] [ps_18] => 500 CT[18] [qty_19] => Array ( [19] => ) [lin_19] => 19[19] [desc_19] => BAG LINER 38X58 1.4MIL BLK[19] [ps_19] => 1/100 CT[19] [qty_20] => Array ( [20] => ) [lin_20] => 20[20] [desc_20] => PAN, STMTBL FOIL 1/2 SZ 4.19 [ps_20] => 100 EA[20] [qty_21] => Array ( [21] => ) [lin_21] => 21[21] [desc_21] => MOZZARELLA WM WISC[21] [ps_21] => 8/6-7#[21] [qty_22] => Array ( [22] => ) [lin_22] => 22[22] [desc_22] => CHEESE, RMNO GRTD PLST REF[22] [ps_22] => 4/5 LB[22] [qty_23] => Array ( [23] => ) [lin_23] => 23[23] [desc_23] => CHICKEN, BRST DBL LOBE 8Z IQF[23] [ps_23] => 1/5#[23] [qty_24] => Array ( [24] => ) [lin_24] => 24[24] [desc_24] => CHEESE, RICOT WHL MILK TUB REF[24] [ps_24] => 1/5LBS[24] [qty_25] => Array ( [25] => ) [lin_25] => 25[25] [desc_25] => CHEESE, BLU CRBL DMSTC BAG REF[25] [ps_25] => 3/5 LB[25] [qty_26] => Array ( [26] => ) [lin_26] => 26[26] [desc_26] => PEPPERONI, AM SLCD 44 MM CKD[26] [ps_26] => 2/12.5 LB[26] [qty_27] => Array ( [27] => ) [lin_27] => 27[27] [desc_27] => PEPPERONI, BF SLCD 14 PER Z[27] [ps_27] => 25 LB[27] [qty_28] => Array ( [28] => ) [lin_28] => 28[28] [desc_28] => BACON CANADIAN C&F[28] [ps_28] => 1/3-5#[28] [qty_29] => Array ( [29] => ) [lin_29] => 29[29] [desc_29] => SALAMI SL NO BURN[29] [ps_29] => 1/4#[29] [qty_30] => Array ( [30] => ) [lin_30] => 30[30] [desc_30] => BACON CKD CHIPS[30] [ps_30] => 1/10#[30] [qty_31] => Array ( [31] => ) [lin_31] => 31[31] [desc_31] => CHICKEN, STRIP BRDD 1.6 Z BRST[31] [ps_31] => 2/5 LB[31] [qty_32] => Array ( [32] => ) [lin_32] => 32[32] [desc_32] => CLAM, BABY WHL CND 200-300 CT[32] [ps_32] => 24/10 OZ[32] [qty_33] => Array ( [33] => ) [lin_33] => 33[33] [desc_33] => ANCHOVY, FIL FLAT REF TIN IMP[33] [ps_33] => 28 OZ[33] [qty_34] => Array ( [34] => ) [lin_34] => 34[34] [desc_34] => OLIVES SL BLK CALIFORNIA[34] [ps_34] => 6/#10[34] [qty_35] => Array ( [35] => ) [lin_35] => 35[35] [desc_35] => JALAPENO SLICED NACHO[35] [ps_35] => 6/#10[35] [qty_36] => Array ( [36] => ) [lin_36] => 36[36] [desc_36] => PEPPERONCINI[36] [ps_36] => 1/1GL[36] [qty_37] => Array ( [37] => ) [lin_37] => 37[37] [desc_37] => ARTICHOKE, HEART QTR CND IMP[37] [ps_37] => 6/3 KG[37] [qty_38] => Array ( [38] => ) [lin_38] => 38[38] [desc_38] => BEAN, KDNY DARK RED BRINE CND[38] [ps_38] => 6/#10 CN[38] [qty_39] => Array ( [39] => ) [lin_39] => 39[39] [desc_39] => TOMATO, GRND UNPLD PEAR IN[39] [ps_39] => 6/#10 CN[39] [qty_40] => Array ( [40] => ) [lin_40] => 40[40] [desc_40] => TOMATO, PUREE XHVY 1.06 CND[40] [ps_40] => 6/#10 CN[40] [qty_41] => Array ( [41] => ) [lin_41] => 41[41] [desc_41] => CANNELLONI, SSG ITLN 5 [ps_41] => 72/3 OZ[41] [qty_42] => Array ( [42] => ) [lin_42] => 42[42] [desc_42] => VINEGAR, WINE RED 50 GRAIN[42] [ps_42] => 4/1 GA[42] [qty_43] => Array ( [43] => ) [lin_43] => 43[43] [desc_43] => MIX, DRSG RANCH ORIG 1 GAL YLD[43] [ps_43] => 18/3.2 OZ[43] [qty_44] => Array ( [44] => ) [lin_44] => 44[44] [desc_44] => SAUCE, PESTO BASL FZN[44] [ps_44] => 6/30 OZ[44] [qty_45] => Array ( [45] => ) [lin_45] => 45[45] [desc_45] => SPICE, PPR RED CRSD SS POUCH[45] [ps_45] => 500/1 GR[45] [qty_46] => Array ( [46] => ) [lin_46] => 46[46] [desc_46] => CROUTONS LRG SQ.SEASD[46] [ps_46] => 10/1#[46] [qty_47] => Array ( [47] => ) [lin_47] => 47[47] [desc_47] => FLOUR, HI GLTEN SUPRM[47] [ps_47] => 50 LB[47] [qty_48] => Array ( [48] => ) [lin_48] => 48[48] [desc_48] => FLOUR RICE[48] [ps_48] => 1/50#[48] [qty_49] => Array ( [49] => ) [lin_49] => 49[49] [desc_49] => FLOUR SEMOLINA[49] [ps_49] => 1/50#[49] [qty_50] => Array ( [50] => ) [lin_50] => 50[50] [desc_50] => CRUMB, BRD ITLN[50] [ps_50] => 6/5#[50] [qty_51] => Array ( [51] => ) [lin_51] => 51[51] [desc_51] => YEAST, CMPRD[51] [ps_51] => 24/1 LB[51] [qty_52] => Array ( [52] => ) [lin_52] => 52[52] [desc_52] => YEAST DRY INSTANT[52] [ps_52] => 20/1#[52] [qty_53] => Array ( [53] => ) [lin_53] => 53[53] [desc_53] => SHORTENING, FRYG SOYBN LIQ CLR[53] [ps_53] => 35 LB[53] [qty_54] => Array ( [54] => ) [lin_54] => 54[54] [desc_54] => SPICE, GRLC PWDR PLST JUG SHLF[54] [ps_54] => 6 LB[54] [qty_55] => Array ( [55] => ) [lin_55] => 55[55] [desc_55] => SPICE, BASL LEAF DRIED BOX[55] [ps_55] => 1.75#[55] [qty_56] => Array ( [56] => ) [lin_56] => 56[56] [desc_56] => OREGANO MED CUT[56] [ps_56] => 1/1.5#[56] [qty_57] => Array ( [57] => ) [lin_57] => 57[57] [desc_57] => SPICE, PPR RED CRSD PLST JUG[57] [ps_57] => 3.75 LB[57] [qty_58] => Array ( [58] => ) [lin_58] => 58[58] [desc_58] => PARSLEY FLAKES[58] [ps_58] => 1/10 OZ[58] [qty_59] => Array ( [59] => ) [lin_59] => 59[59] [desc_59] => BOX, PIZA 16X16X1.87 CRBRD[59] [ps_59] => 50 EA[59] [qty_60] => Array ( [60] => ) [lin_60] => 60[60] [desc_60] => BOX, PIZA 12X12X1.87 CRBRD[60] [ps_60] => 50 EA[60] [qty_61] => Array ( [61] => ) [lin_61] => 61[61] [desc_61] => CONTAINER, FM 16 Z SQT WHT[61] [ps_61] => 20/25 EA[61] [qty_62] => Array ( [62] => ) [lin_62] => 62[62] [desc_62] => CONTAINER, FM 8 Z SQT WHT[62] [ps_62] => 20/250[62] [qty_63] => Array ( [63] => ) [lin_63] => 63[63] [desc_63] => CUP 12 OZ FOAM 12B16/12J16[63] [ps_63] => 1/1000 CT[63] [qty_64] => Array ( [64] => ) [lin_64] => 64[64] [desc_64] => CUP 20 OZ 20B16/20J16[64] [ps_64] => 1/500 CT[64] [qty_65] => Array ( [65] => ) [lin_65] => 65[65] [desc_65] => LID 12-16-20 L16ST/16SL[65] [ps_65] => 1/1000 CT[65] [qty_66] => Array ( [66] => ) [lin_66] => 66[66] [desc_66] => LID 20OZ 20JL[66] [ps_66] => 1/1000 CT[66] [qty_67] => Array ( [67] => ) [lin_67] => 67[67] [desc_67] => SEAT COVER, TLT 1/2 FLD PAPR[67] [ps_67] => 20/250 EA[67] [qty_68] => Array ( [68] => ) [lin_68] => 68[68] [desc_68] => NAPKIN 15X17 2 PLY[68] [ps_68] => 12/250 CT[68] [qty_69] => Array ( [69] => ) [lin_69] => 69[69] [desc_69] => CUP, SOUFFLE PLASTIC 3.25 OZ TNSLT[69] [ps_69] => 10/250[69] [qty_70] => Array ( [70] => ) [lin_70] => 70[70] [desc_70] => CONTAINER 2 1/4# OBL ALUM[70] [ps_70] => 1/500 CT[70] [qty_71] => Array ( [71] => ) [lin_71] => 71[71] [desc_71] => LID 2 1/4 FOIL BOARD[71] [ps_71] => 1/500 CT[71] [qty_72] => Array ( [72] => ) [lin_72] => 72[72] [desc_72] => CONTAINER, FOIL 7 [ps_72] => 1/500[72] [qty_73] => Array ( [73] => ) [lin_73] => 73[73] [desc_73] => LID 7 FOIL BOARD[73] [ps_73] => 1/500 CT[73] [qty_74] => Array ( [74] => ) [lin_74] => 74[74] [desc_74] => LID 9 FOIL BOARD[74] [ps_74] => 1/500 CT[74] [qty_75] => Array ( [75] => ) [lin_75] => 75[75] [desc_75] => CONTAINER, FOIL 9 [ps_75] => 1/500[75] [qty_76] => Array ( [76] => ) [lin_76] => 76[76] [desc_76] => CONTAINER, FM 5.62X5.75 1[76] [ps_76] => 504[76] [qty_77] => Array ( [77] => ) [lin_77] => 77[77] [desc_77] => CONTAINER, FM 6X6 1 CMPT WHT[77] [ps_77] => 504[77] [qty_78] => Array ( [78] => ) [lin_78] => 78[78] [desc_78] => PAN, STMTBL FOIL 1/2 SZ 2.5 [ps_78] => 100 EA[78] [qty_79] => Array ( [79] => ) [lin_79] => 79[79] [desc_79] => PAN LID, PAN 1/2 SZ FOIL CVR[79] [ps_79] => 100 EA[79] [qty_80] => Array ( [80] => ) [lin_80] => 80[80] [desc_80] => STRAW, GIANT 7.75 [ps_80] => 1/300 EA[80] [qty_81] => Array ( [81] => ) [lin_81] => 81[81] [desc_81] => TOOTHPICK, WOOD RND 2.5 [ps_81] => 15/1000[81] [qty_82] => Array ( [82] => ) [lin_82] => 82[82] [desc_82] => SCRUBBER, S/S 50 GR ECON 400[82] [ps_82] => 12 EA[82] [qty_83] => Array ( [83] => ) [lin_83] => 83[83] [desc_83] => SYRUP, FONTN COLA COKE CLSC[83] [ps_83] => 5 GA[83] [qty_84] => Array ( [84] => ) [lin_84] => 84[84] [desc_84] => SYRUP, FONTN PIBB XTRA B-I-B[84] [ps_84] => 5 GA[84] [qty_85] => Array ( [85] => ) [lin_85] => 85[85] [desc_85] => SYRUP, FONTN ROOT BEER BARQS[85] [ps_85] => 5 GA[85] [qty_86] => Array ( [86] => ) [lin_86] => 86[86] [desc_86] => SYRUP, FONTN COLA DIET COKE[86] [ps_86] => 5 GA[86] [qty_87] => Array ( [87] => ) [lin_87] => 87[87] [desc_87] => SYRUP, FONTN LMN LIME SPRTE[87] [ps_87] => 5 GA[87] [qty_88] => Array ( [88] => ) [lin_88] => 88[88] [desc_88] => SYRUP, FONTN LMNDE MIN MAID[88] [ps_88] => 5 GA[88] [qty_89] => Array ( [89] => ) [lin_89] => 89[89] [desc_89] => TEA BASE, ICED RSP SWTND 5:1[89] [ps_89] => 5 GA[89] [qty_90] => Array ( [90] => ) [lin_90] => 90[90] [desc_90] => TOMATO, WHL W/ BASL IN PUREE[90] [ps_90] => 6/#10 CN[90] [qty_91] => Array ( [91] => ) [lin_91] => 91[91] [desc_91] => CUP LID, CUP SOUFFLE 3.25-4 Z FLAT[91] [ps_91] => 20/120 EA[91] [qty_92] => Array ( [92] => ) [lin_92] => 92[92] [desc_92] => LINGUICA SL SAUSAGE[92] [ps_92] => 1/3#[92] [qty_93] => Array ( [93] => ) [lin_93] => 93[93] [desc_93] => MEATBALL, .5 Z ITLN CKD IQF[93] [ps_93] => 6/#10 CN[93] [qty_94] => Array ( [94] => ) [lin_94] => 94[94] [desc_94] => BAG, C-OUT 12 LB PAPR KRAFT[94] [ps_94] => 500 EA[94] [qty_95] => Array ( [95] => ) [lin_95] => 95[95] [desc_95] => BAG LINER, 40-45 GAL 40X46 BLK 1.2[95] [ps_95] => 125 EA[95] [qty_96] => Array ( [96] => ) [lin_96] => 96[96] [desc_96] => PINEAPPLE TID[96] [ps_96] => 6/#10[96] [qty_97] => Array ( [97] => ) [lin_97] => 97[97] [desc_97] => CRACKER, OYSTR LG SS[97] [ps_97] => 300/.5OZ[97] [qty_98] => Array ( [98] => ) [lin_98] => 98[98] [desc_98] => PAN LID, PAN FULL SZ FOIL CVR[98] [ps_98] => 80[98] [qty_99] => Array ( [99] => ) [lin_99] => 99[99] [desc_99] => OIL OLIVE BLND 75/25[99] [ps_99] => 1/35#[99] [qty_100] => Array ( [100] => ) [lin_100] => 100[100] [desc_100] => PASTA, PENNE RIGTE SHLF STABL[100] [ps_100] => 2/10 LB[100] [qty_101] => Array ( [101] => ) [lin_101] => 101[101] [desc_101] => PASTA, SPAG SHLF STABL[101] [ps_101] => 2/10 LB[101] [qty_102] => Array ( [102] => ) [lin_102] => 102[102] [desc_102] => LINER, BASKET 12X12 RED CHECKERD[102] [ps_102] => 5/1000 EA[102] [qty_103] => Array ( [103] => ) [lin_103] => 103[103] [desc_103] => DRESSING MIX BLU CHSE[103] [ps_103] => 18/1 GAL[103] [qty_104] => Array ( [104] => ) [lin_104] => 104[104] [desc_104] => CONTAINER, FM 8.25X8 1 CMPT[104] [ps_104] => 2/100 EA[104] [qty_105] => Array ( [105] => ) [lin_105] => 105[105] [desc_105] => CONTAINER, FM 8.42X8.15 1[105] [ps_105] => 2/100[105] [qty_106] => Array ( [106] => ) [lin_106] => 106[106] [desc_106] => CONTAINER, FM 8.42X8.15 3[106] [ps_106] => 2/100[106] [qty_107] => Array ( [107] => ) [lin_107] => 107[107] [desc_107] => CONTAINER, FM 8.4X8.2 1 CMPT[107] [ps_107] => 2/100[107] [qty_108] => Array ( [108] => ) [lin_108] => 108[108] [desc_108] => CONTAINER, FM 8X8.5 1 CMPT[108] [ps_108] => 2/100[108] [qty_109] => Array ( [109] => ) [lin_109] => 109[109] [desc_109] => CONTAINER, FM 9.12X9 1 CMPT[109] [ps_109] => 2/100[109] [qty_110] => Array ( [110] => ) [lin_110] => 110[110] [desc_110] => CONTAINER, FM 9.25X9.25 1[110] [ps_110] => 2/100 EA[110] [qty_111] => Array ( [111] => ) [lin_111] => 111[111] [desc_111] => CONTAINER, FM 9.25X9.25 3[111] [ps_111] => 2/100 EA[111] [qty_112] => Array ( [112] => ) [lin_112] => 112[112] [desc_112] => CONTAINER, FM 9X9 1C WHT INTLK[112] [ps_112] => 2/100[112] [qty_113] => Array ( [113] => ) [lin_113] => 113[113] [desc_113] => [113] [ps_113] => [113] [qty_114] => Array ( [114] => ) [lin_114] => 114[114] [desc_114] => TORTELLINI, CHS TRI COLOR[114] [ps_114] => 2/5 LB[114] [qty_115] => Array ( [115] => ) [lin_115] => 115[115] [desc_115] => SALAMI, ALL-MEAT ITALIAN STICK 3.5 LBA DRY CURED REF[115] [ps_115] => 4/3.5 LBA[115] [qty_116] => Array ( [116] => ) [lin_116] => 116[116] [desc_116] => CHEESE, PARMESAN GRATED BAG REF[116] [ps_116] => 4/5 LB[116] [qty_117] => Array ( [117] => ) [lin_117] => 117[117] [desc_117] => CHICKEN, BRST SNGL LOBE 8 OZ[117] [ps_117] => 48/8 OZ[117] [qty_118] => Array ( [118] => ) [lin_118] => 118[118] [desc_118] => PEPPER, BELL GRN LG 22-28 LB[118] [ps_118] => 25# / 1.1BU[118] [qty_119] => Array ( [119] => ) [lin_119] => 119[119] [desc_119] => SALAMI, GENOA PORK BEEF STICK 6 LBA ALL NATURAL UNCURED REF DELI-FACED[119] [ps_119] => 2/7 LBA[119] [qty_120] => Array ( [120] => ) [lin_120] => 120[120] [desc_120] => LEMON, CHO FRESH REF[120] [ps_120] => 115 EA[120] [qty_121] => Array ( [121] => ) [lin_121] => 121[121] [desc_121] => MUSHROOM, WHT SM BTTN #1 GRD[121] [ps_121] => 10 LB[121] [qty_122] => Array ( [122] => ) [lin_122] => 122[122] [desc_122] => PEPPERONI, AM SLCD 14-16 CT[122] [ps_122] => 25 LB[122] [qty_123] => Array ( [123] => ) [lin_123] => 123[123] [desc_123] => PEPPERONI, SLCD 14-16 CT NO[123] [ps_123] => 2/12.5[123] [qty_124] => Array ( [124] => ) [lin_124] => 124[124] [desc_124] => CELERY, STALK LG FRESH REF[124] [ps_124] => 24 EA[124] [qty_125] => Array ( [125] => ) [lin_125] => 125[125] [desc_125] => CAULIFLOWER, WHT FRESH REF[125] [ps_125] => 12/1 EA[125] [qty_126] => Array ( [126] => ) [lin_126] => 126[126] [desc_126] => EGG, SHL LG GRD AA WHT TRAY[126] [ps_126] => 15 DZ[126] [qty_127] => Array ( [127] => ) [lin_127] => 127[127] [desc_127] => BURRITO, CHIX MINI FZN APTZR[127] [ps_127] => 228 EA[127] [qty_128] => Array ( [128] => ) [lin_128] => 128[128] [desc_128] => PEPPER, BELL RED 22-28 LB[128] [ps_128] => 25# / 1.1BU[128] [qty_129] => Array ( [129] => ) [lin_129] => 129[129] [desc_129] => POTATO, RUSET NON-ID. 90 CT[129] [ps_129] => 50 LB[129] [qty_130] => Array ( [130] => ) [lin_130] => 130[130] [desc_130] => POTATO, RUSET ID. 60 CT FRESH[130] [ps_130] => 50 LB[130] [qty_131] => Array ( [131] => ) [lin_131] => 131[131] [desc_131] => VEGETABLE BLEND, CA. NRD FZN[131] [ps_131] => 12/2#[131] [qty_132] => Array ( [132] => ) [lin_132] => 132[132] [desc_132] => TEA BASE, ICED BLACK RASPBERRY SWEETENED 5.5:1 BAG-IN-BOX CAFFEINATED SHELF[132] [ps_132] => 5 GA[132] [qty_133] => Array ( [133] => ) [lin_133] => 133[133] [desc_133] => VEGETABLE BLEND, CPRI FZN[133] [ps_133] => 12/2#[133] [qty_134] => Array ( [134] => ) [lin_134] => 134[134] [desc_134] => CAULIFLOWER, FROZEN[134] [ps_134] => 12/2 LB[134] [qty_135] => Array ( [135] => ) [lin_135] => 135[135] [desc_135] => SALAD MIX, ICBRG W/ RED CBG[135] [ps_135] => 4/5 LB[135] [qty_136] => Array ( [136] => ) [lin_136] => 136[136] [desc_136] => CABBAGE, GRN SHRD FRESH REF[136] [ps_136] => 5 LB[136] [qty_137] => Array ( [137] => ) [lin_137] => 137[137] [desc_137] => CARROT, SHRD 1/16 [ps_137] => 1/5 LB[137] [qty_138] => Array ( [138] => ) [lin_138] => 138[138] [desc_138] => SHRIMP, CKD 26-30 P&D B/TGR[138] [ps_138] => 4/2.5 LB[138] [qty_139] => Array ( [139] => ) [lin_139] => 139[139] [desc_139] => LETTUCE, RMN FRESH REF[139] [ps_139] => 24 EA[139] [qty_140] => Array ( [140] => ) [lin_140] => 140[140] [desc_140] => GARLIC, WHL CLOVE PLD #2 GRD[140] [ps_140] => 4/5 LB[140] [qty_141] => Array ( [141] => ) [lin_141] => 141[141] [desc_141] => GARLIC, WHT JMB WHL CLOVE PLD[141] [ps_141] => 4/5 LB[141] [qty_142] => Array ( [142] => ) [lin_142] => 142[142] [desc_142] => LETTUCE, ICBRG PREM FRESH REF[142] [ps_142] => 24 EA[142] [qty_143] => Array ( [143] => ) [lin_143] => 143[143] [desc_143] => CREAM, WHPG HVY MANFC DARY CTN[143] [ps_143] => 6/.5 GA[143] [qty_144] => Array ( [144] => ) [lin_144] => 144[144] [desc_144] => LETTUCE, RMN CHPD PILO PK[144] [ps_144] => 6/2 LB[144] [qty_145] => Array ( [145] => ) [lin_145] => 145[145] [desc_145] => PEPPER, BELL GRN SM CHPPR[145] [ps_145] => 25# / 1.1BU[145] [qty_146] => Array ( [146] => ) [lin_146] => 146[146] [desc_146] => CHEESE, MOZZ LOAF LMWM CRYOVAC[146] [ps_146] => 8/6 LBA[146] [qty_147] => Array ( [147] => ) [lin_147] => 147[147] [desc_147] => CHEESE, MOZZ LOAF LMWM V/PK[147] [ps_147] => 8/6 LBA[147] [qty_148] => Array ( [148] => ) [lin_148] => 148[148] [desc_148] => MILK, WHL CTN REF HMGNZ[148] [ps_148] => 2/1 GA[148] [qty_149] => Array ( [149] => ) [lin_149] => 149[149] [desc_149] => TACO, CHIX SHRD MINI .5 Z CKD[149] [ps_149] => 4/4 LB[149] [qty_150] => Array ( [150] => ) [lin_150] => 150[150] [desc_150] => SALAMI, GENOA SLICED GAS FLUSHED REF[150] [ps_150] => 4/3 LB[150] [qty_151] => Array ( [151] => ) [lin_151] => 151[151] [desc_151] => CHICKEN, TENDR 2.66Z BRDD FRTR[151] [ps_151] => 2/5 LB[151] [qty_152] => Array ( [152] => ) [lin_152] => 152[152] [desc_152] => CUP, FOAM 24 OZ WHT[152] [ps_152] => 25/20[152] [qty_153] => Array ( [153] => ) [lin_153] => 153[153] [desc_153] => BEAN, PINTO FCY CND IN BRINE[153] [ps_153] => 6/#10 CN[153] [qty_154] => Array ( [154] => ) [lin_154] => 154[154] [desc_154] => ITALIAN ICE, LMNDE SOFT CUP[154] [ps_154] => 12/12 OZ[154] [qty_155] => Array ( [155] => ) [lin_155] => 155[155] [desc_155] => ITALIAN ICE, STWBY LMNDE SOFT[155] [ps_155] => 12/12 OZ[155] [qty_156] => Array ( [156] => ) [lin_156] => 156[156] [desc_156] => RICE, PILAF[156] [ps_156] => 6/2.25 LB[156] [qty_157] => Array ( [157] => ) [lin_157] => 157[157] [desc_157] => CUP, FOAM 14 OZ WHT[157] [ps_157] => 40/25 EA[157] [qty_158] => Array ( [158] => ) [lin_158] => 158[158] [desc_158] => LID, CUP 12-24 Z BBL PLST[158] [ps_158] => 1000 EA[158] [qty_159] => Array ( [159] => ) [lin_159] => 159[159] [desc_159] => LID, CUP 8 OZ VENTED PLST WHT[159] [ps_159] => 10/100 EA[159] [qty_160] => Array ( [160] => ) [lin_160] => 160[160] [desc_160] => MAYONNAISE, B-I-B SHLF STABL[160] [ps_160] => 30 LB[160] [qty_161] => Array ( [161] => ) [lin_161] => 161[161] [desc_161] => MAYONNAISE, XHVY B-I-B SHLF[161] [ps_161] => 30 LB[161] [qty_162] => Array ( [162] => ) [lin_162] => 162[162] [desc_162] => ZUCCHINI, GRN MED FRESH REF[162] [ps_162] => 25LBS[162] [qty_163] => Array ( [163] => ) [lin_163] => 163[163] [desc_163] => BUTTER, GRD AA UNSLD REF[163] [ps_163] => 55 LB[163] [qty_164] => Array ( [164] => ) [lin_164] => 164[164] [desc_164] => DRESSING, ITLN DLX PLST REF[164] [ps_164] => 4/1 GA[164] [qty_165] => Array ( [165] => ) [lin_165] => 165[165] [desc_165] => BASE, CLAM NO MSG REF PLST[165] [ps_165] => 6/1 LB[165] [qty_166] => Array ( [166] => ) [lin_166] => 166[166] [desc_166] => BASE, CLAM PASTE NO MSG SHLF[166] [ps_166] => 6/1 LB[166] [qty_167] => Array ( [167] => ) [lin_167] => 167[167] [desc_167] => BEEF, STK RIBEY CHO 1112A L/ON[167] [ps_167] => 24/8 OZ AV[167] [qty_168] => Array ( [168] => ) [lin_168] => 168[168] [desc_168] => PASTA, FARFL BOW TIE SHLF[168] [ps_168] => 2/10 LB[168] [qty_169] => Array ( [169] => ) [lin_169] => 169[169] [desc_169] => MILK, BTRMLK 1% BUTRFT CTN REF[169] [ps_169] => 9/.5GA[169] [qty_170] => Array ( [170] => ) [lin_170] => 170[170] [desc_170] => CRAYON, ASST BULK[170] [ps_170] => 3200 EA[170] [qty_171] => Array ( [171] => ) [lin_171] => 171[171] [desc_171] => SEASONING, STK MNTRL RUB PLST[171] [ps_171] => 7#[171] [qty_172] => Array ( [172] => ) [lin_172] => 172[172] [desc_172] => BACON, PORK END & PC 1/2 [ps_172] => 6/2#[172] [qty_173] => Array ( [173] => ) [lin_173] => 173[173] [desc_173] => BEEF, STRIP LOIN 0X1 CHO 180[173] [ps_173] => 6/12 LB[173] [qty_174] => Array ( [174] => ) [lin_174] => 174[174] [desc_174] => PORK, BSTN BUTT BNLS RAW REF[174] [ps_174] => 10/6 LBA[174] [qty_175] => Array ( [175] => ) [lin_175] => 175[175] [desc_175] => ANTIOXIDANT, WHTN ALL[175] [ps_175] => 6/4 LB[175] [qty_176] => Array ( [176] => ) [lin_176] => 176[176] [desc_176] => VEAL, CUTLT 4 Z 4DM PRPND[176] [ps_176] => 80 CT[176] [qty_177] => Array ( [177] => ) [lin_177] => 177[177] [desc_177] => CHICKEN, BRST DBL LOBE 6Z[177] [ps_177] => 48/6 OZ[177] [qty_178] => Array ( [178] => ) [lin_178] => 178[178] [desc_178] => CHICKEN, BRST SNGL LOBE 5 OZ[178] [ps_178] => 48CT[178] [qty_179] => Array ( [179] => ) [lin_179] => 179[179] [desc_179] => PASTA, GNOCH PTATO FZN[179] [ps_179] => 3/4 LB[179] [qty_180] => Array ( [180] => ) [lin_180] => 180[180] [desc_180] => GNOCCHI, POTATO PARCOOKED FROZEN BAG[180] [ps_180] => 4/3 LB[180] [qty_181] => Array ( [181] => ) [lin_181] => 181[181] [desc_181] => TOMATO, PLUM #1 GRD BOX FRESH[181] [ps_181] => 25 LB[181] [qty_182] => Array ( [182] => ) [lin_182] => 182[182] [desc_182] => BROCCOLI, FLORET IQF FROZEN[182] [ps_182] => 12/2 LB[182] [qty_183] => Array ( [183] => ) [lin_183] => 183[183] [desc_183] => BUTTER, SALTD SS REF BUT-R-CUP[183] [ps_183] => 936/5 GR[183] [qty_184] => Array ( [184] => ) [lin_184] => 184[184] [desc_184] => BUTTER, WHPD SALTD SS CUP REF[184] [ps_184] => 720/5 GR[184] [qty_185] => Array ( [185] => ) [lin_185] => 185[185] [desc_185] => PRESOAK, FLTWR PWDR PLST BTL[185] [ps_185] => 48 TABLETS[185] [qty_186] => Array ( [186] => ) [lin_186] => 186[186] [desc_186] => PASTA, ANGEL HAIR 10 [ps_186] => 2/10 LB[186] [qty_187] => Array ( [187] => ) [lin_187] => 187[187] [desc_187] => CREAMER, HALF & HALF DARY SS[187] [ps_187] => 400 EA[187] [qty_188] => Array ( [188] => ) [lin_188] => 188[188] [desc_188] => ONION, RED JMB FRESH 3 [ps_188] => 50#[188] [qty_189] => Array ( [189] => ) [lin_189] => 189[189] [desc_189] => DEODORIZER, URNL SCRN W/ BLOC[189] [ps_189] => 12 EA[189] [qty_190] => Array ( [190] => ) [lin_190] => 190[190] [desc_190] => BEEF, TRI TIP CHO 185C RAW[190] [ps_190] => 4/17 LBA[190] [qty_191] => Array ( [191] => ) [lin_191] => 191[191] [desc_191] => NAPKIN, DNNR WHT 15X16 2 PLY[191] [ps_191] => 30/100 EA[191] [qty_192] => Array ( [192] => ) [lin_192] => 192[192] [desc_192] => ONION RING, BTRD BEER 5/8 [ps_192] => 6/2.5#[192] [qty_193] => Array ( [193] => ) [lin_193] => 193[193] [desc_193] => EGGPLANT, WHL FRESH REF[193] [ps_193] => 18 EA[193] [qty_194] => Array ( [194] => ) [lin_194] => 194[194] [desc_194] => CARROT, JMB FRESH REF[194] [ps_194] => 25 LB[194] [qty_195] => Array ( [195] => ) [lin_195] => 195[195] [desc_195] => BRATWURST, LNK 4:1 8 [ps_195] => 2/5 LB[195] [qty_196] => Array ( [196] => ) [lin_196] => 196[196] [desc_196] => CAKE, MOUSS MANGO NOT ICED 4.5[196] [ps_196] => 2/12/4.5 OZ[196] [qty_197] => Array ( [197] => ) [lin_197] => 197[197] [desc_197] => EGG ROLL, CHIX CSHEW SPICY 1 Z[197] [ps_197] => 100/1 OZ[197] [qty_198] => Array ( [198] => ) [lin_198] => 198[198] [desc_198] => HAM, BNLS D-SHAPED SMKD APLWD[198] [ps_198] => 2/7 LBA[198] [qty_199] => Array ( [199] => ) [lin_199] => 199[199] [desc_199] => LID, BWL 12-32 Z PLST VTD[199] [ps_199] => 10/100[199] [qty_200] => Array ( [200] => ) [lin_200] => 200[200] [desc_200] => PEPPER, BELL YLW DMSTC 22-28[200] [ps_200] => 22-28#[200] [qty_201] => Array ( [201] => ) [lin_201] => 201[201] [desc_201] => RAVIOLI, LOB .57 Z RND PRCKD[201] [ps_201] => 2/3 LB[201] [qty_202] => Array ( [202] => ) [lin_202] => 202[202] [desc_202] => SAUSAGE, ITLN MILD 4:1 6 [ps_202] => 2/5 LB[202] [qty_203] => Array ( [203] => ) [lin_203] => 203[203] [desc_203] => LINER, PAN FOOD 16.4X24.4 PARCHMENT PAPER QUILON TREATED GREASE RESISTANT[203] [ps_203] => 1000 EA[203] [qty_204] => Array ( [204] => ) [lin_204] => 204[204] [desc_204] => BEEF, GROUND 81/19 FINE RAW REF CHUB[204] [ps_204] => 6/5 LBA[204] [qty_205] => Array ( [205] => ) [lin_205] => 205[205] [desc_205] => GLASS, COOLER 14 OZ CLEAR[205] [ps_205] => 2 DZ[205] [qty_206] => Array ( [206] => ) [lin_206] => 206[206] [desc_206] => CHICKEN, THIGH MEAT JUMBO BONELESS-SKINLESS RAW REF CVP[206] [ps_206] => 4/10 LB[206] [qty_207] => Array ( [207] => ) [lin_207] => 207[207] [desc_207] => MILK, BUTTERMILK 1% BUTTERFAT CARTON REF[207] [ps_207] => 6/.5 GA[207] [qty_208] => Array ( [208] => ) [lin_208] => 208[208] [desc_208] => MILK, WHOLE RBST FREE CARTON REF CALIFORNIA STANDARD HOMOGENIZED[208] [ps_208] => 2/1 GA[208] [qty_209] => Array ( [209] => ) [lin_209] => 209[209] [desc_209] => CREAM, WHIPPING HEAVY MANUFACTURING 40% BUTTERFAT PASTEURIZED DAIRY RBST FR[209] [ps_209] => 6/.5 GA[209] [qty_210] => Array ( [210] => ) [lin_210] => 210[210] [desc_210] => CONTAINER, FOAM 5.75X5.75 1 CMPT WHITE 3.25 H HINGED LID INTELLILOCK[210] [ps_210] => 6/84 EA[210] [qty_211] => Array ( [211] => ) [lin_211] => 211[211] [desc_211] => LID, CONTAINER 5-16 OZ VENTED PLASTIC TRANSLUCENT COVER[211] [ps_211] => 10/100 EA[211] )



using this code
<?

$i = 0;

while (isset($_POST['qty_' . $i])) {

  if (empty($_POST['qty_' . $i])) {

     continue;

  }

  $qty = $_POST['qty_' . $i];

  $lin = $_POST['lin_' . $i];

  $desc = $_POST['desc_' . $i];

  $ps = $_POST['ps_' . $i];

if ($qty != "" || $qty != 0 || $qty != "0" || $qty != " "){

echo $lin;
echo $qty;
echo $desc;
echo $ps;
}else{
continue;
}


 
$i++;

}



nothing prints.

can someone tell me what I am doing wrong if i do it this way (since I understand this way)

Thanks

and pay close attention to the first 3 qty_i fields, they are the only ones with values, I do not need the rest of the array. only the first 3.
Was This Post Helpful? 0
  • +
  • -

#22 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3524
  • View blog
  • Posts: 12,031
  • Joined: 12-December 12

Re: PHP / multi-dimensional arrays / mysql

Posted 26 May 2013 - 12:23 PM

There is no qty_0 post-variable so your loop is never entered.
Was This Post Helpful? 1
  • +
  • -

#23 pokey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-May 13

Re: PHP / multi-dimensional arrays / mysql

Posted 26 May 2013 - 12:54 PM

View Postandrewsw, on 26 May 2013 - 12:23 PM, said:

There is no qty_0 post-variable so your loop is never entered.


I see, thanks
Was This Post Helpful? 0
  • +
  • -

#24 pokey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-May 13

Re: PHP / multi-dimensional arrays / mysql

Posted 26 May 2013 - 01:48 PM

Thank you all for your help with this. I would be in the asylum without all your help. :)

So i decided to attack it like this:

<?

$qtyarr = array();
$qtyarr = $_POST;

foreach ($qtyarr['qty_' . $i] as $key => $value){
if ($value != "" || $value != "0") {

$line_num = $_POST['lin_' . $i];
echo $line_num; 

$desc = $_POST['desc_' . $i];
echo $desc;

$ps = $_POST['ps_' . $i];
echo $ps;

$i++;

}ELSE{
continue;
}
}
?>



however, I am getting the following error response.


Warning: Invalid argument supplied for foreach() in D:\Hosting\1145411\html\my_review_order2.php on line 176


Why is that a bad foreach? What can I do?

It looks good to me, lol
Was This Post Helpful? 0
  • +
  • -

#25 macosxnerd101  Icon User is offline

  • Self-Trained Economist
  • member icon




Reputation: 10596
  • View blog
  • Posts: 39,259
  • Joined: 27-December 08

Re: PHP / multi-dimensional arrays / mysql

Posted 26 May 2013 - 01:50 PM

The foreach loop expects an array, while $qtyarr['qty_' . $i] is not an array. The $qtyarr array is also empty, so why iterate through it? This doesn't make sense.
Was This Post Helpful? 1
  • +
  • -

#26 pokey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-May 13

Re: PHP / multi-dimensional arrays / mysql

Posted 26 May 2013 - 01:53 PM

I see.

Thanks
Was This Post Helpful? 0
  • +
  • -

#27 pokey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 23-May 13

Re: PHP / multi-dimensional arrays / mysql

Posted 27 May 2013 - 07:49 PM

It works, YES!

Maybe not the best code or up to date but it works for now. :surrender:

<?
echo "<table border ='1'><tr><td align = 'center'>Quantity Ordered</td><td align = 'center'>Line Number</td><td align = 'center' width='80%'>Description</td><td align = 'center' width='10%' >Pack Size</td></tr>";

$qtyarr = $_POST;

if (!isset ($qty)){
    $qty = array();
}
if (!isset ($_SESSION['qty'])){
    $_SESSION['qty'] = array();
}

if (!isset ($lin)){
    $lin = array();
}
if (!isset ($_SESSION['line'])){
    $_SESSION['line'] = array();
}

if (!isset ($description)){
    $description = array();
}
if (!isset ($_SESSION['desc'])){
    $_SESSION['desc'] = array();
}

if (!isset ($pack_size)){
    $pack_size = array();
}
if (!isset ($_SESSION['ps'])){
    $_SESSION['ps'] = array();
}

for ($i=3; $i<=count($_POST); $i++)
  {

if ($_POST['qty_' . $i] == '0' || $_POST['qty_' . $i] == "" || $_POST['qty_' . $i] == 0){

}ELSE{

$line_num == "";
$desc == "";
$ps == "";

echo"<tr>";
echo"<td align = 'center'>";
$qty[] = $_POST['qty_' . $i];

echo $_POST['qty_' . $i];
echo"</td>";

echo"<td align = 'center'>";
$line_num = $_POST['lin_' . $i];
$lin[] = $_POST['lin_' . $i];
echo $line_num;
echo"</td>";

echo"<td>";
$desc = $_POST['desc_' . $i];
$description[] = $_POST['desc_' . $i];
echo $desc;
echo"</td>";

echo"<td align = 'center'>";
$ps = $_POST['ps_' . $i];
$pack_size[] = $_POST['ps_' . $i];
echo $ps;
echo"</td></tr>";


}

continue;
$i++;
}

$_SESSION['qty'] = $qty;
$_SESSION['lin'] = $lin;
$_SESSION['desc'] = $description;
$_SESSION['ps'] = $pack_size;


?>



Maybe not the best code but it works, I can pay someone to clean it up later.

I now have a new problem that I really need help with.

Now that I have reviewed the order for them, once they click the confirm button, it takes them to a new page which I will then insert all the session data in mysql database fields.

The $result array now has only the data that I need. (their order)



<?
include 'config.php';

$qty = array();
$lin = array();
$desc = array();
$ps = array();

$qty = $_SESSION['qty'];
$lin = $_SESSION['lin'];
$desc = $_SESSION['desc'];
$ps = $_SESSION['ps'];

$result = array_merge($qty, $lin, $desc, $ps);

for ($i=0; $i<=count($result); $i++)
  {

mysql_query("INSERT INTO orders (user_name, qty_ordered, line_num, description, win_pack_size) VALUES ('$login_name', '$result['qty'], '$result['lin'], '$result['desc'], '$result['sp'] )") or die(mysql_error());  

}

?>



This is what the merged array looks like after executing the above code
Array ( [0] => 20 [1] => 30 [2] => 50 [3] => 3 [4] => 4 [5] => 5 [6] => CHEESE, PARM RMNO BLND GRTD [7] => CHEESE, PARM GRTD BAG REF IMP [8] => CHEESE, RMNO HALF WHEEL WAX [9] => 2/5 LB [10] => 1/5 LB [11] => 20# )





1. How do I insert this data with the same type of keys [0],[1], etc. into different mysql fields
(0->3->6->9 all go together as does 1->4->7->10 and should be written on the same line in the mysql database.

I am thinking I have to change the keys some how so the description could have ['desc'] keys and the quantity would have ['qty'] keys, etc so I can put them in the correct mysql fields as i loop through it, as my code shows, but doesnt work, right?

I am very appreciative of the help and this forum.

I hope my description makes sense.

Thank you.
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2