View Single Post
Selecting a MySQL database with PHP?
(#1 (permalink))
Old
Laura is Offline
Private
Points: 191, Level: 2 Points: 191, Level: 2 Points: 191, Level: 2
Activity: 0% Activity: 0% Activity: 0%
Laura is an unknown quantity at this point
 
 
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Join Date: Dec 2007
Selecting a MySQL database with PHP? - December 28th, 2007

This is my first website using MySQL and PHP and I'm having some troubles. So...I'm connected to the MySQL server using mysql_connect - no problem there. But when trying to select a database, I get the error 'unknown database'. This is what I wrote to select:
if (!@mysql_select_db('my_database')){
die ('<p>Could not select the database because: <b>'. mysql_error(). '</b></p>');}

To make my database I used MySQL Server 2005 Express. And I also have XAMPP -- I chose it because it was the only Apache that would run for me. Anyone has any idea what I might be doing wrong?
As far as I know the database is created I created it in Mysql server management studio. I don't know should I do something more with it, it's not enough to just create it there?

Revenue Shared Ads