Duane,

Thks for the reply, however it didn't work.

Do you or anyone else have any suggestions.

It is greatly appreciated.

Thanks,
Greg

--- In [email protected], "Duane A. Couchot-Vore" <[EMAIL PROTECTED]>
wrote:
>
> I don't know what the "db" class is, but I imagine that your query to
> insert a record flushes the previous result set.  You might try
> something like:
> 
> $results=array();
> // while ( $results[]=$db->Fetch_array($sql) ); might work but
> // I've never tried it.
> while($tresults = $db->Fetch_array($sql))
>   $results[]=$tresults;
> foreach ( $results as $result ){ 
>   $ext_price = $result['fld_qty'] * $result ['fld_price'];
>   $db->query("
>               insert into
>                  tbl_orders_has_tbl_products
>               set
>                  fld_order_id = '$order_id',
>                  fld_prod_id = '$arr_cart_items[fld_prod_id]',
>                  fld_quantity = '$arr_cart_items[fld_qty]', 
>                  fld_ext_price = '$ext_price',
>                  fld_unit_price = '$arr_cart_items[fld_price]'
>                  ")
>                or $db->PrintErrors();
>                       
> }
> 
> > --- In [email protected], "libertyhosting" <greg@> wrote:
> >
> > Hi All,
> > 
> > I don't know what I am missing, but when ran without the query it
> > iterate through the array, however when the query is added, only 1
> > record is inserted. Any ideas?
> > 
> > Thanks, 
> > Greg
> > 
> > ----------------------------
> > 
> > while($arr_cart_items = $db->Fetch_array($sql)){
> > 
> > $ext_price = $arr_cart_items['fld_qty'] *
$arr_cart_items['fld_price'];
> >                             
> > $sql = $db->query("
> >             insert into
> >                     tbl_orders_has_tbl_products
> >             set
> >                     fld_order_id = '$order_id',
> >                     fld_prod_id = '$arr_cart_items[fld_prod_id]',
> >                     fld_quantity = '$arr_cart_items[fld_qty]', 
> >                     fld_ext_price = '$ext_price',
> >                     fld_unit_price = '$arr_cart_items[fld_price]'
> >                     ")
> >                     or $db->PrintErrors();
> >                     
> > }
> >
>


Reply via email to