Hi, I have been using a script on my site to handle admin log ins, but I was just using a text file, now I want to store this info in a database, but I am having problems getting it to loop. This was my old code
$user_passwords = array (
"user1" => "passsword1",
"user2" => "password2",
"user3" => "password3",
"user4" => "password4"
);
So I decided to try this:
$query_data = "SELECT * FROM acl";
$data = mysql_query($query_data, $dbconnect) or die(mysql_error());
$row_data = mysql_fetch_assoc($data);
$totalRows_data = mysql_num_rows($data);
?>
<?
$user_passwords = array (
$row_data['username'] => $row_data['PASSWORD'],
);
Wich works great, except the only name/pass in the db that works is that of the first entry, so I need it to loop through so all the name/passes will be avilable.
I tried this:
$query_data = "SELECT * FROM acl";
$data = mysql_query($query_data, $dbconnect) or die(mysql_error());
$row_data = mysql_fetch_assoc($data);
$totalRows_data = mysql_num_rows($data);
?>
<?
$user_passwords = array (
<?php do { ?>
$row_data['username'] => $row_data['PASSWORD'],
<?php } while ($row_data = mysql_fetch_assoc($data)); ?>
);
And that gives me a parse error, says ')" expexted in line 14, wich is: <?php do { ?>
Can someone please help?