jimbo_3000 Posted January 18, 2009 Share Posted January 18, 2009 I am trying to get the users info from an array but i am only getting this. Jim_bo Array: Tammy Array: ------------------- How can I display the Id, the username and the rest of the information thats there. Thanks, Jim <?php $users = array( 'Jim_bo' => array ('id' => 10001, 'Username' => 'Jim_bo1', 'FullName' => 'Jim Carr', 'Password' => 'pass', 'Email' => 'jimbo@123.com'), 'Tammy' => array ('id' => 10002, 'Username' => 'TammyG', 'FullName' => 'Tammy Gebremicael', 'Password' => 'pass1', 'Email' => 'tammyg@123.com') ); foreach ( $users as $user_data => $field ) { echo "<p>$user_data</p> <p> $field: </p>"; } ?> Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted January 18, 2009 Share Posted January 18, 2009 foreach ($users as $user_name => $user_data) { echo "<p>$user_name</p>"; foreach ($user_data as $field => $value) { echo "<p>$field - $value</p>"; } } Quote Link to comment Share on other sites More sharing options...
jimbo_3000 Posted January 18, 2009 Author Share Posted January 18, 2009 Thanks for the help Mark, it works great! Jim Quote Link to comment Share on other sites More sharing options...
mike12255 Posted January 19, 2009 Share Posted January 19, 2009 you should click on the "Topic Solved" button at the bottom of the page mate, this way people wont look at this anymore since there isnt much need. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.