- to create databases I'm using xampp->phpyadmin,
- I have created a database called "dungeons",
in my php code Im connecting to MySQL with this code:
if ($_SERVER["SERVER_ADDR"]=="localhost") { define("SQL_HOST","localhost"); define("SQL_DBNAME","dungeons"); define("SQL_USERNAME",xxx); define("SQL_PASSWORD",xxx); } else { define("SQL_HOST","127.0.0.1"); define("SQL_DBNAME","dungeons"); define("SQL_USERNAME", xxx); define("SQL_PASSWORD",xxx); } mysql_connect(SQL_HOST, SQL_USERNAME, SQL_PASSWORD) or die("Cannot connect to mySQL: " . mysql_error()); mysql_select_db(SQL_DBNAME) or die("Cannot connect to the database: ". mysql_error());
The error message says
Unknown database 'dungeons', when selecting db.
I don't have any idea where the problem is, since the database is made and I have successfully connected to the mysql with the code.