note 6578 deleted from mysql_select_db by ronabop

From: Date: Wed, 23 Aug 2000 10:00:28 +0000
Subject: note 6578 deleted from mysql_select_db by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-2989@lists.php.net to get a copy of this message
A newbie, same problem.. used php 3.0.12 (php, apache,mysql - all reside on one Linux host), everything worked fine. Having installed Php4 (as by the tutorial) I am now having problems with mysql_select_db. Here is the function: function db_connect($host = "localhost", $user = "myuser", $password = "pass") { global $corporate; $db = mysql_connect($host,$user,$password); $link= mysql_select_db($database = "mydb",$db); } function db_query($sql) { global $result; $result = mysql_query($sql,$link); if (mysql_errno()!=0) { echo "sql in "$sql"<br>n"; echo "error: ".mysql_error()."<BR>"; } } What I get: Supplied argument is not a valid Mysql-Link resource on line ... (refers to $result). What should I change? AFAI noticed, mysql_query had should be mysql_query_db, anything else?

« previous php.notes (#2989) next »