I suddenly gοt this:
Warning: mysql_connect(): in C:\xampp\htdocs\login.php on line 12
cannot connect to server A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
I use this code:
$dbhost="localhost";
$dbusername="dbusername";
$dbpassword="dbpassword";
$db_name="database";
mysql_connect("$dbhost", "$dbusername", "$dbpassword") or die("cannot connect to server". mysql_error());
mysql_select_db("$db_name") or die("cannot select db". mysql_error());
Changing host to:
$dbhost="127.0.0.1";
everything works fine again.
Why did it happen? How can I fix it to work as before? Thank you!