0

Why my page doesn't work anymore after I added this code in:

<?php 
    $conn = mysqli_connect($host, $user, $pw, $db);
    if ($conn == false) {
        die("Es konnte keine Verbindung zur Datenbank hergestellt werden");
    }
?>

The error which I get is:

ERR_EMPTY_RESPONSE

If I uncomment this code then it works.

How can I solve this?

Mahendra Gunawardena
  • 1,956
  • 5
  • 26
  • 45
Cihat
  • 835
  • 1
  • 7
  • 17

3 Answers3

-1

change your code to this:

 <?php
$servername = "localhost";
$username = "username";
$password = "password";

// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?> 
Blueblazer172
  • 588
  • 2
  • 15
  • 44
-1

Do it like this, hope it will work

$conn = new mysqli($host, $user, $pw, $db);
if ($conn->connect_error) {
   die("Connection failed: " . $conn->connect_error);
}
Waleed Ahmed Haris
  • 1,229
  • 11
  • 17
-2

First you should check your database connectivity code, recheck the dbconfig php file. assign correct values for config db.

Check Blueblazer172 answer. it will help you.

Sathishkumar
  • 419
  • 2
  • 8
  • 20