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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

array listing 1

Status
Not open for further replies.

Extreme43

Programmer
Dec 21, 2004
23
AU
hey,
i was making a login system using a text file instead of a database,
i have got most of it done but am stuck at listing the usernames in foreach() statement

this is the text file with the profiles of the users
is it possible to list users and how....

Code:
$data = array ( 

"users" => array ( 


	"Extreme43" => array (
    	"Password" => "password",
    	"Email"    => "email"
	)
),

"banned" => array (

      	"insert ip here" => "banned"
  	)

);

i can list the users password and email by having

Code:
foreach($data['check']['Extreme43'] as $F1 => $F2) {

echo "$F1 : $F2<br>";



}
but as you see you have to type in their username
 
Code:
foreach ($data['check'] as $user=>$info)
{
  echo "Username: $user<br>";
  foreach ($info as $f1=>$f2)
  {
    echo "$fi: $f2<br>";
  }
}

--Chessbot

There is a level of Hell reserved for probability theorists in which every monkey that types on a typewriter produces a Shakespearean sonnet.
 
sure

--Chessbot

There is a level of Hell reserved for probability theorists in which every monkey that types on a typewriter produces a Shakespearean sonnet.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top