Hey,
for a project I have to fetch the following array from my DB
Array
(
[admin] => Array ( [password] => admin [level] => 99 )
[test] => Array ( [password] => test [level] => 1 )
...
)
What I'm recieving however looks like this:
Array
(
[..] => Array ( [password] => [level] => )
[0] => testmail1@mail.com [1] => Array ( [password] => 1234567 [level] => 99 )
[2] => testmail2@mail.com [3] => Array ( [password] => 7654321 [level] => 55 )
...
)
The problem is the appearance of the [0]=> , [1]=> etc in each row.
My code is the following one
$users=array ( "$email" => array("password" =>$passwd, "level"=>$level ) );
echo "<hr>";
$result = @mysql_query( "select email, passwd, level from personen order by id" ) or die("Invalid query 1: " . mysql_error());
for ($i=0; $i<@mysql_num_rows($result); $i++)
{
$k=@mysql_fetch_array ($result);
$email= "$k[email]";
$passwd="$k[passwd]";
$level="$k[level]";
$loginfo = array ("password"=>$passwd, "level"=>$level );
array_push($users, $email, $loginfo );
}
print_r ($users); echo "<hr>";
Anyone got an idea whats wrong?
Thanks in advance