What is corret way to connect to MySQL?

Posted by sky on Stack Overflow See other posts from Stack Overflow or by sky
Published on 2010-04-19T15:13:37Z Indexed on 2010/04/19 15:33 UTC
Read the original article Hit count: 162

Filed under:
|
|

what is the correct way to connect to MySQL database without the mysql_fetch_assoc() error?

Getting [Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource] with mysql_connect('localhost', 'name', 'pass'); mysql_select_db('dbname');

getting mysql_fetch_assoc() error without mysql_select_db any suggest?

CODE are:

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

?>

var somethings= ;

© Stack Overflow or respective owner

Related posts about php

Related posts about AJAX