Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Only retrieves last string

Status
Not open for further replies.

PBE3

Programmer
Aug 16, 2007
25
US
I am trying to spit out all names into an array, but I keep getting just the last object.


for($i=0; $i<count($allLoc); $i++){
//$allLoc is query results

if($allLoc[$i]['storecode']!=$allLoc[$i]['orig_store'] && $allLoc[$i]['storecode']==$currStoreLoc){

$store=array();
array_push($store, $allLoc[$i]['orig_store']);

}
}

My Problem ->$store on outputs 1 store, the particular instance I am testing should have 3, but it is just giving me the very last one.

Any ideas?? Thanks...Kudos!!!
 
move the $store=array() outside the loop.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top