me1000 Posted March 3, 2008 Share Posted March 3, 2008 so here is the array (which holds an array for each value) $data = array( array('name'=>'Title 1','number'=>"$intEnrolled") ,array('name'=>'Title 2','number'=>"$intCompleted") ,array('name'=>'Title 3','number'=>"$intExpired") ,array('name'=>'Title 4','number'=>"$intProgress") ); Now I need to get every value from the array... so I need like a foreach loop or something, but I need to get both values ('name' and 'number') I just dont know exactly how to do it, foreach (){ echo 'name'.' IS '.'number'; } which would display as Title 1 IS $intEnrolled Title 2 IS $intCompleted etc... I hope this makes since, Thanks, Link to comment https://forums.phpfreaks.com/topic/94102-retrieve-data-from-arrays/ Share on other sites More sharing options...
teng84 Posted March 3, 2008 Share Posted March 3, 2008 <? $data = array( array('name'=>'Title 1','number'=>$intEnrolled) ,array('name'=>'Title 2','number'=>$intCompleted) ,array('name'=>'Title 3','number'=>$intExpired) ,array('name'=>'Title 4','number'=>$intProgress) ); foreach($data as $val){ echo $val['name'].' IS '. $val['number'].'<br/>'; } ?> try and you dont need the "" on your var.. Link to comment https://forums.phpfreaks.com/topic/94102-retrieve-data-from-arrays/#findComment-482060 Share on other sites More sharing options...
me1000 Posted March 3, 2008 Author Share Posted March 3, 2008 Thank You!! Link to comment https://forums.phpfreaks.com/topic/94102-retrieve-data-from-arrays/#findComment-482077 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.