Re: Re: Function Problem

From: Date: Sun, 10 Nov 2002 09:31:59 +0000
Subject: Re: Re: Function Problem
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-123670@lists.php.net to get a copy of this message
At 08:16 10.11.2002, conbud said: --------------------[snip]-------------------- >also I have the function wrong in my original question I have it as >function db_conn($host,$user,$pass,$dab) >{ >$db = mysql_connect("$host", "$user","$pass" >mysql_select_db("$dab",$db); >} > >and not >function db_conn($host,$user,$pass,$dab) >{ >$db = mysql_connect("$host", >"$user","$pass")mysql_select_db("$dab",$db); >} --------------------[snip]-------------------- mysql_select_db already opens a connection to the database; you don't need the mysql_connect() call afterwards. In your code you have mysql_select_db() as fourth parameter to mysql_connect(). While the fourth parameter is boolean and won't generate any error at runtime, it's use- and senseless. The 4th parameter on mysql_connect specifies if PHP should use an existing link, or create a new one. You should decide whether you want to go with mysql_select_db() or mysql_connect(). -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#123670) next »