Results 1 to 2 of 2
Thread: using mamp/ local server
-
February 11th, 2010, 10:08 PM #1778**** Hawk
postsusing mamp/ local server
<?php //this file contains information to connect to database
DEFINE('DB_USER', 'root');
DEFINE('DB_PASSWORD', 'root');
DEFINE('DB_HOST', 'localhost');
DEFINE('DB_NAME', 'helpDesk');
$dbc = @mysqli_connect(DB_USER, DB_PASSWORD, DB_HOST, DB_NAME) OR die ('could not connect to the database: ' . mysqli_connect_error());
mysqli_query($dbc, 'SET NAMES utf8');
?>
I get this "could not connect to the database: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known"
Is this wrong?
-
February 17th, 2010, 08:30 AM #2
Yes, this is wrong. The database is not the fourth parameter to the `mysqli_connect' function. Instead, you need to connect and then select the database:
Hope that helpsPHP Code:$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASS);
mysqli_select_db($dbc, DB_NAME);
"60% of the time it works... every time." -- Paul Rudd as Brian Fantana.

Reply With Quote

Bookmarks