|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
array problems
I'm trying to retrieve 11 set of members record from the db. Each member will have a unique id. Thus I want to append an array like so: array( "2" => "jack", "11" => "peter" )
PHP Code:
with the above code, I got Array ( [20] => Jack ) Array ( [20] => Jack [4] => peter ) Array ( [20] => Jack [5] => may ) Array ( [20] => Jack [9] => douglas ) what I want is actually: Array ( [20] => Jack, [4] => peter, [5] => may ... What should I do? Thanks alot. |
|
#2
|
|||
|
|||
|
You need to post more code before we can help you...
__________________
~ Joe Penn We work for free to help make this a valuable resource on the internet. Do you appreciate the help - did we provide help that will help you prosper and help that has contributed to sharpening your current skill set? Show your appreciation and purchase something from our Amazon Wishlist's - it's simple and a great way to say thank you. |
|
#3
|
|||
|
|||
|
Re: array problems
Quote:
You are producing exactly what you wanted... What makes you think this is not working?
__________________
__________________________________________________ _ Wil Moore III, MCP | Integrations Specialist | Senior Consultant Are You Listed...? | DigitallySmooth Inc. |
|
#4
|
|||
|
|||
|
forgive me if i sound stupid (ive been drinking) but how do you mean array(....
are you using the print_r function to output this data? dont forget to declair the array before you call it in your loop eg $array = array(); also each key MUST be unique, so ensure that the key is unique before setting it. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > array problems |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|