The forums have permanently moved to This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.

Results 1 to 2 of 2

Thread: using mamp/ local server

  1. #1

    using 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?

  2. #2
    icio's Avatar
    looks better in lowercase
    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:

    PHP Code:
    $dbc mysqli_connect(DB_HOSTDB_USERDB_PASS);
    Hope that helps
    "60% of the time it works... every time." -- Paul Rudd as Brian Fantana.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Home About Meet the Moderators Advertise

 Link to Us


Copyright 1999 - 2012