[thelist] mySQL/PHP - INSERT not working [UPDATED]

Johnson, Christopher (MTO) Christopher.Johnson at mto.gov.on.ca
Thu Jun 17 11:00:15 CDT 2004

$conn only makes a connection with mysql, not with a database. Once you have
the connection, you need to tell mysql which database to use. It is exactly
the same if you access mysql from the command line. First you log into mysql
(make the connection) and then you have to issue the 'use dbname' command
(where dbname is the name of a database inside of mysql) before you can
actually perform any queries.

use this after you make the connection to select the database to use:

mysql_select_db('YOUR DATABASE NAME');


-----Original Message-----
From: Tom Dell'Aringa

And I'm getting the following error:

Invalid query: No Database Selected

How can that be if $conn didn't fail? Do I somewhere have to specify the
name of the DB? 

More information about the thelist mailing list