Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Aug 2017
    Location
    New Delhi
    Posts
    88

    How to make database connection in PHP?

    How to make database connection in PHP?

  2. #2

  3. #3
    Registered User
    Join Date
    Mar 2019
    Location
    Ahmedabad
    Posts
    180
    <?php
    $servername="localhost";
    $db ="database";
    $userName="username";
    $pass="password";

    $conn = mysqli_connect($servername,$db,$userName,$pass);

    if($conn->connect_error) {
    die("connection failed".$conn->connect_error);
    }
    echo "Connected Successfully";

    mysqli_close($conn);

    ?>

  4. #4

  5. #5
    Senior Member
    Join Date
    Mar 2020
    Posts
    1,214
    php $servername = "localhost"; $database = "database"; $username = "username"; $password = "password"; // Create connection $conn = mysqli_connect($servername, $username, $password, $database); // Check connection if ($conn->connect_error) { die("Connection failed: "

  6. #6
    Senior Member
    Join Date
    Aug 2020
    Posts
    355
    php $servername = "localhost"; $database = "database"; $username = "username"; $password = "password"; // Create connection $conn = mysqli_connect($servername, $username, $password, $database); // Check connection if ($conn->connect_error) { die("Connection failed: "

  7. #7
    Senior Member
    Join Date
    Aug 2020
    Posts
    258
    php $servername = "localhost"; $database = "database"; $username = "username"; $password = "password"; // Create connection $conn = mysqli_connect($servername, $username, $password, $database); // Check connection if ($conn->connect_error) { die("Connection failed: "

Posting Permissions

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

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.