I am testing a local page using xampp. Searching how to fix a "No database selected" mysql error lead me to testing this out:
mysql_connect('localhost') or die ("Connect error");
$res = mysql_query("SHOW DATABASES");
while ($row = mysql_fetch_row($res))
{
echo $row[0], '<br/>';
}
But that query only shows two results: "information_schema" and "test". Which I don't understand cause on phpMyAdmin I can see all this databases:
cdcol, information_schema, mysql, performance_schema, phpmyadmin, test, xxxxxxxx_db (the one I created) and webauth
And (on phpMyAdmin) I can see that root has privileges to this database. Root has no password.
Thanks in advance.
EDIT:
I have an actual site online, I use mysql_connect and such to connect to the database... But I had to reinstall xampp and dreamweaver and everything on my PC and then had to download the database and the whole site cause I need to test some things locally. I can't afforrd to change the mysql querys and use PDO for now, maybe later when I have the time.
My main problem is the connection, it doesn't work, It prints "No database selected". I don't know why it doesn't find my xxxxxxxx_db database.
echo ini_get('mysql.default_username'), ini_get('mysql.default_password');?mysql_fetch_array()