Localhost vs. 127.0.0.1
I have always set up my PHP to MySql connections like this:$host="localhost"; // Host name
$username="myuser"; // Mysql username
$password="myawesomepw"; // Mysql password
$db_name="db_name"; // Database name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
All of a sudden I was getting cannot connect errors. So I contacted my ISP and was told to NEVER use localhost and to only use 127.0.0.1. I was under the impression they were the same thing. Not to mention the fact I have always used localhost to connect, but I guess it is not good practice to use it.
Select a link on the right
Feel like contacting me feel free:
eday69@gmail.com
PHP