We've expanded our news coverage and improved our search! Visit
news.oreilly.com for the latest or search for all things across O'Reilly!
Article:
 |
|
Using MySQL from PHP
|
| Subject: |
|
Connect to MySQL DB |
| Date: |
|
2007-12-15 08:23:06 |
| From: |
|
krsbuilt
|
Response to: Connect to MySQL DB
|
|
Your Problem is that the database connection isn't using the mysql connection. If you did it like this:
mysql_connect($hostname,$username, $password) or die ('Error connecting to mysql');
mysql_select_db($dbname);
it might work. since you were making the mysql cnnection a variable, your database connection couldn't use it. now if you make the mysql connection not a variable then anything in the script can access it.
|