PDA

View Full Version : [invalid] mysql_connect with db_name parameter can't connect to DB


si.ruslan
01-31-2011, 05:50 PM
May be a bug?
works fine

$db = mysql_connect("localhost", "user", "psswd");
mysql_select_db("db_name", $db);
$res = mysql_query ("SELECT * FROM `test`", $db);
echo $res;


response : "MysqliResult[JDBC4ResultSet]"

not works

$db = mysql_connect("localhost", "user", "psswd", "db_name");
$res = mysql_query ("SELECT * FROM `test`", $db);
echo $res;


response : false

domdorn
01-31-2011, 11:07 PM
there is no fourth argument in mysql_connect to specify the db-name.
please see http://de.php.net/mysql_connect
for the allowed arguments.

si.ruslan
02-01-2011, 07:23 PM
Sorry ... You are righ