You are here: Re: multiple inserts into a db « PHP « IT news, forums, messages
Re: multiple inserts into a db

Posted by "Satyam" on 10/20/59 11:16

You are missing loading the $i item of the $Session_variable_with_itemID
into $ses_basket_id' before doing the insert.

Satyam

"Mayo" <mayo@nycinteractive.com> wrote in message
news:000001c55c2d$e7749c70$259b1d18@ghcm7sj76pvb9b...
> I'm putting ordered items into a db. The information is stored in
> session variables.
>
> Session_variable_with_itemID_has(1001,1002,1003,1004) however when
> inserted into the db only 0,0,0,0 is recorded.
>
> Assuming that this was the 40th recorded order the table should look
> like this
>
> TABLE: orderedItems
>
> orderedItemsID -- orderID - itemID
>
> 159 - 40 - 1001
> 160 - 40 - 1002
> 161 - 40 -- 1003
> 162 - 40 - 1004
>
> What comes out is:
>
> orderedItemsID -- orderID - itemID
>
> 159 - 40 - 0
> 160 - 40 - 0
> 161 - 40 -- 0
> 162 - 40 - 0
>
>
> The loop itself works as intended. However it is not inserting this
> variable.
>
> $ses_basket_items is the total number of items
> $orderID = the orderID which these items are a part of
> $ses_basket_id = is the itemID number
>
>
>
> for ($i=0;$i<$ses_basket_items;$i++){
>
> $query = "INSERT INTO orderedItems (orderID,itemID) VALUES
> ('$orderID','$ses_basket_id')";
>
> mysql_query($query) or die('Error, insert query failed');
>
> }
>
> mysql_close($conn);
>
> thx
>
>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация