tags:

views:

143

answers:

8
+2  A: 

Typo? Your question has msyql_select_db instead of mysql_select_db - note the swap of the s and y in mysql.

Tim
A: 
$connect = mysql_connect('host', 'user', 'pass);
           mysql_select_db('database', $connect);

That's how you connect to a database.

You also spelled mysql wrong.

Getting Fatal error: Call to undefined function msyql_select_db() with mysql_connect('localhost', 'name', 'pass'); <<msyql>>_select_db('dbname');

Arrows around the error.

Andrew
A: 

you spelled your function incorrectly mysql not msyql

DrLazer
A: 

I do not understand your question, but maybe this will help.

$session = mysql_connect('host','username','password');

mysql_select_db('database', $session);

$resultset = mysql_query('SELECT * FROM TABLE', $session);

$result = mysql_fetch_assoc($resultset);

Good luck...

Ian P
A: 

May want to change localhost to '127.0.0.1' as well...I've had issues with that before.

Zachary
+1  A: 

Try:

$result= mysql_query('SELECT DISTINCT username FROM users'); 
$somethings= array(); 
while ($row= mysql_fetch_assoc($result)) { 
    $somethings[]= $row['something']; 
}

Basically changing $results to $result.

Foobar
yep, but after im getting blank page, i checked source and this is showing.Warning: json_encode() expects exactly 1 parameter, 2 given in line 17. any idea? thanks
sky
If you look at line 17, you will see you have 2 parameters to the json_encode function. There should only be 1, the data you wish to encode.
Foobar
A: 
Murali Krishna kilari
I wouldn't recommend suppressing any errors that may arise when trying to connect to the database.
Ian P
A: 
Murali Krishna kilari