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' => '[email protected]'), 'Tammy' => array ('id' => 10002, 'Username' => 'TammyG', 'FullName' => 'Tammy Gebremicael', 'Password' => 'pass1', 'Email' => '[email protected]') ); foreach ( $users as $user_data => $field ) { echo "<p>$user_data</p> <p> $field: </p>"; } ?> Link to comment https://forums.phpfreaks.com/topic/141373-solved-getting-user-info/ 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>"; } } Link to comment https://forums.phpfreaks.com/topic/141373-solved-getting-user-info/#findComment-739975 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 Link to comment https://forums.phpfreaks.com/topic/141373-solved-getting-user-info/#findComment-740114 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. Link to comment https://forums.phpfreaks.com/topic/141373-solved-getting-user-info/#findComment-740196 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.