Re: Re: Newbie Setup Trouble

From: Date: Mon, 07 Feb 2005 16:09:52 +0000
Subject: Re: Re: Newbie Setup Trouble
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-38493@lists.php.net to get a copy of this message
To all, I am sorry the correct line is: mysql_select_db($link,"database name") If you are missing the database name you will get an error concerning undefined function. jzf J. Connolly wrote:
Mike, There is no database sepcified in your code anywhere. The line:
               $result = mysql_query($sql); does not specify which database you are connecting to either. You can specify the database in the line:
               $link = mysql_connect($host,$user,$password,$database);    //or in a separate line with the function
               mysql_select_db("database name",$link)    //where $link is the connection info above
And then use in the line:
               $result = mysql_query($link, $sql);   //this enable the query to find the connection and the code.
I hope this makes sense. I have only been doing this a couple of weeks. Some books have the ($link,$sql) order reversed which will also give you an error. IN ADDITION, if you are using mysqli you need to enter this ext in the PHP.ini file. I can only connect using mysqli and not mysql. Good luck, jzf


« previous php.db (#38493) next »