Old 25-05-2007, 10:46   #1 (permalink)
Gautam
Registered User
 
Join Date: May 2007
Posts: 1
PHP - ForEach Loop

Thanks for your reply. That did not work.

This is the loop used.

Code:
foreach ($data['item']['optstats'] as $x) { echo $x['ProgramID']; echo "<br />" . "<br />"; }

Code:
CODE 1 : Array ( [item] => Array ( [optstats] => Array ( [0] => Array ( [Date] => 05/23/2007 [Campaign] => ABC [ProgramID] => 123 [Info] => 123 [Amount] => LEAD N/A [TransactionID] => LEAD N/A [Commission] => $ 10.00 ) [1] => Array ( [Date] => 05/23/2007 [Campaign] => ABC [ProgramID] => 123 [Info] => 123 [Amount] => LEAD N/A [TransactionID] => LEAD N/A [Commission] => $ 07.50 ) ) ) )

Output for code 1 :

Code:
123 123

This is correct.

Code 2 :

Code:
Array ( [item] => Array ( [optstats] => Array ( [Date] => 05/23/2007 [Campaign] => ABC [ProgramID] => 123 [Info] => 123 [Amount] => LEAD N/A [TransactionID] => LEAD N/A [Commission] => $ 10.00 ) ) )

Output :

Code:
0 4 L L $

For security reasons, I have changed some variable values.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8