Jump to content

Array duplicate first value


gvp16

Recommended Posts

Hi, I have a multidimentional array which looks like this :

 

array(2) { ["HOKIT100E-041"]=> array(3) { [0]=> string(26) "Honda Cr 125-250 2000-2001" [1]=> string(5) "89.99" [2]=> string(1) "1" } 
["WAFAXS"]=> array(3) { [0]=> string(27) "Wulf Flite-x Helmet - Green" [1]=> string(5) "65.94" [2]=> string(1) "1" } } 

 

howver when I do a foreach on it, the 1st array is being duplicated and I have no idea why :(

 

this is the code I have :

 

foreach($basketArray as $key => $value)
{
echo$nvpstr = $nvpstr ."<br/><br/>&L_PAYMENTREQUEST_0_NUMBER$q=".$key." 
        <br/>&L_PAYMENTREQUEST_0_NAME$q=".$value[0]." 
        <br/>&L_PAYMENTREQUEST_0_AMT$q=".$value[1]." 
        <br/>&L_PAYMENTREQUEST_0_QTY$q=".$value[2];
$q++;
}

 

this is what is output :

 

&L_PAYMENTREQUEST_0_NUMBER0=HOKIT100E-041

&L_PAYMENTREQUEST_0_NAME0=Honda Cr 125-250 2000-2001

&L_PAYMENTREQUEST_0_AMT0=89.99

&L_PAYMENTREQUEST_0_QTY0=1

 

&L_PAYMENTREQUEST_0_NUMBER0=HOKIT100E-041

&L_PAYMENTREQUEST_0_NAME0=Honda Cr 125-250 2000-2001

&L_PAYMENTREQUEST_0_AMT0=89.99

&L_PAYMENTREQUEST_0_QTY0=1

 

&L_PAYMENTREQUEST_0_NUMBER1=WAFAXS

&L_PAYMENTREQUEST_0_NAME1=Wulf Flite-x Helmet - Green

&L_PAYMENTREQUEST_0_AMT1=65.94

&L_PAYMENTREQUEST_0_QTY1=1

 

Have I made a schoolboy error?

 

Thanks.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.