Jump to content

Problem with Chat System (MySql)


Beatz89

Recommended Posts

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 :o

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.