Jump to content

eildydar

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Everything posted by eildydar

  1. $query = ('CREATE TEMPORARY TABLE tempresult(variety varchar(50), grade varchar(50), cont varchar(50),quantity varchar(50), order_num varchar(50), location varchar(50), size varchar(50))'); $result = mysql_query($query) or die(mysql_error()); $query1= ('CREATE TEMPORARY TABLE invoicegrade select dmcongr.cggrdu, dmcongr.cgrseq, dmcongr.cggrdi, invgradejoin.cggrdu AS invgrade FROM dmcongr INNER JOIN dmcongr AS invgradejoin ON dmcongr.cggrdi = invgradejoin.cgrseq'); $result1 = mysql_query($query1) or die(mysql_error()); $query2= ('CREATE TEMPORARY TABLE tempGrade(SELECT t1.invgrade, dwoshp.sbfile as ordering, dwoshp.sbbrnu as brand FROM invoicegrade t1 left join dwoshp on t1.cggrdu = dwoshp.sbgrdu where dwoshp.sbfile = "'.$_POST[order].'" AND dwoshp.sbbrnu = "'.$_POST[location].'")'); $result2= mysql_query($query2) or die(mysql_error()); $query3=('CREATE TEMPORARY TABLE tempVar(SELECT dmconvr.cxvrnm, dwoshp.sbvaru, dwoshp.sbsizu, dwoshp.sbfile as ordering, dwoshp.sbbrnu as brand FROM dmconvr left join dwoshp on dmconvr.cxrseq = dwoshp.sbvar WHERE dwoshp.sbfile = "'.$_POST[order].'" AND dwoshp.sbbrnu = "'.$_POST[location].'")'); $result3=mysql_query($query3) or die(mysql_error()); $query6=('SELECT invgrade FROM tempGrade'); $result6 = mysql_query($query6); $query7 = ('SELECT cxvrnm, sbvaru FROM tempVar'); $result7 = mysql_query($query7); while($row=mysql_fetch_array($result6)) { $invgrade[] = $row['invgrade']; } while($rows=mysql_fetch_array($result7)) { $var[] = $rows['cxvrnm']; $varu[] = $rows['sbvaru']; } for ($i=0; $i < count($var); $i++) { $quer = ("SELECT sbbx0, sbsizu FROM dwoshp WHERE sbfile = '$_POST[order]' and sbbrnu = '$_POST[location]' AND sbvaru = '$varu[$i]'"); $res = mysql_query($quer); while($r = mysql_fetch_array($res)) { $quant = $r['sbbx0']; $sizu = $r['sbsizu']; } $query_AddDots = "INSERT INTO tempresult(variety,grade,cont, quantity, size) VALUES ('$var[$i]', '$invgrade[$i]','TP','$quant', $sizu)"; $AddDots = mysql_query($query_AddDots) or die(mysql_error()); }
  2. Okay I fixed one problem and came up with another. I took out the [$i] from the end of the $sizu variable. That made the first line output correctly with 150 but the second line is also 150. It looks like the following RED DELICIOUS WX TP 49 150 RED DELICIOUS WX TP 49 150 I think it has to do with the $var being the same because if I query for a different order number it outputs correctly as shown below DANJOU PEARS US1 TP 180 54 BOSC US1 TP 120 48 ORGANIC DANJ US1 TP 180 212 ORGANIC RED USX TP 180 212
  3. sorry at the end is a select * from tempresults; and instead of printing Variety Grade Cont 12346 150 Variety Grade Cont 126 120 instead it prints Variety Grade Cont 12346 1 Variety Grade Cont 126 5
  4. Hey guess I have a question about For Loops. I'm very new to php so please forgive anything stupid I am doing The follow code shows what I am trying to do with my for loop. It works great except that the $sizu value is spread out over all the fields. So instead of saying 150 in the first record set it prints 1 and then in the second record it prints 2 etc. Any idea what is causing this? If you need to see the rest of the code let me know I'm just trying to save bandwidth at first. for ($i=0; $i < count($var); $i++) { $quer = ("SELECT sbbx0, sbsizu FROM dwoshp WHERE sbfile = '$_POST[order]' and sbbrnu = '$_POST[location]' AND sbvaru = '$varu[$i]'"); $res = mysql_query($quer); while($r = mysql_fetch_array($res)) { $quant = $r['sbbx0']; $sizu = $r['sbsizu']; } $query_AddDots = "INSERT INTO tempresult(variety,grade,cont, quantity, size) VALUES ('$var[$i]', '$invgrade[$i]','TP','$quant', $sizu[$i])"; $AddDots = mysql_query($query_AddDots) or die(mysql_error()); }
×
×
  • 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.