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.

J. Connolly wrote:

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,

-- PHP Database Mailing List ( To unsubscribe, visit:

Reply via email to