Results 1 to 2 of 2
Thread: using mamp/ local server
February 11th, 2010, 10:08 PM #1778**** Hawk
using mamp/ local server
<?php //this file contains information to connect to database
$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:
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASS);
"60% of the time it works... every time." -- Paul Rudd as Brian Fantana.