-
Problems
This line enable URL Rewriting . It must be enabled via the RewriteEngine directive! and if your .htaccess file is going to use rewrite rules, you should always include this line. Otherwise, you can’t be sure if its enabled or not. The string “on” is case insensitive.
Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\xampp\htdocs\include\connect.php on line *
Warning: mysql_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in C:\xampp\htdocs\include\connect.php on line *
Unable to connect to MySQL: php_network_getaddresses: getaddrinfo failed: No such host is known.
ARE YOU GETTING TROUBLE DUE TO ABOVE ERROR IN XAMPP . You have came to right place . We will give you complete solution
FIRST CASE :Showing error in inline decleration of host username and password
$db = mysql_connect("localhost", "root", "pwd");
SOLUTION:Error may be due to wrong hostname , username , password . Recheck your input value
SECOND CASE : Showing error in external file declaration such as 1) You have file with all the constant 2) you have file containing code to connect database in which you have included above (1) file .
constant.php
<?php
$db_hostname = 'localhost';
$db_username ='name';
$db_password = 'psw';
$database_name = 'dbname';
?>
$db_hostname = 'localhost';
$db_username ='name';
$db_password = 'psw';
$database_name = 'dbname';
?>
connect.php
<?php
include 'constant.php';
$db_server = mysql_connect($db_hostname, $db_username, $db_password);
if (!$db_server) die("Unable to connect to MySQL: " . mysql_error());
mysql_select_db($database_name) or die(mysql_error());
?>
SOLUTION: TRY inline declaration
connect.php
<?php
$db_server = mysql_connect('localhost', 'name', 'psw');
if (!$db_server) die("Unable to connect to MySQL: " . mysql_error());
mysql_select_db('dbname') or die(mysql_error());
?>
If you have any further error than please write it in comment
No comments:
Post a Comment