Okay so kinda new to php and been looking around google for hours trying to figure this out, I am trying to get this array from MySql instead of it being hardcoded as my website always has new users... This is for a chat system built into the site.
Table = user_table
$row1 = Username
$row2 = Password
function SimpleLoginSystem() {
$this->aExistedMembers = array(
'User1' => 'qwerty',
'User2' => 'assdf',
'User3' => 'qwe',
'Beatz' => '123'
);
}
I have tried many variations of MySql queries and inserting into the array list, but every time (even when I echo_r($array) and copy and paste the user and pass it still says wrong user/pass... Anyone that can help me with this?
Would be much appreciated
function SimpleLoginSystem() {
$vLink = mysql_connect("localhost", "root", "password");
mysql_select_db("website");
$resultset = mysql_query("SELECT Username, Password FROM user_table");
$this->aExistedMembers = array();
for ($i = 1; $line = mysql_fetch_assoc($resultset); $i++) aExistedMembers[$i] = $line;
echo mysql_error();
print_r($aExistedMembers);
}
Sorry if I haven't explained this too well I am not too good at explaining