I am trying to create an automated log in system with cakePHP and need a bit of help working out how to get an array of possible log ins. At the moment I have this code, which means I have to manually add in the log in details each time a new user is needed:
$this->Security->loginUsers = array(
'user1' => 'password1',
'user2' => 'password2'
);
I have a mysql table called 'operators' which looks like this:
**Username Password**
user1 password1
user2 password2
user3 password3
etc. and this is automatically populated from a registration form. Could someone please tell me how I would turn the table into an array like the one above so that I can use it in the cakePHP code?
Thanks for any help
Edit: This is the code I have now but it doesn't work
$test = mysql_query("SELECT * FROM operators");
while($row = mysql_fetch_array($test))
{
$array = "'".$row['username']."' => '".$row['password']."'";
}
$this->Security->loginUsers = $array;