0

I'm having some problems with my website. The domain is bitcointap.xyz. On the /register & /login page. I'm having some PHP errors. On the /register page (bitcointap.xyz/register) I get the error:

"Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in ../ on line 7"

Register.php: http://pastebin.com/4pqvyiL1

Another problem I'm having is with the Login.php page. I get the error;

mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in ../ on line 9

Login.php: http://pastebin.com/ednfCE1y

Any help is greatly appreciated. Thank you.

Sinister Beard
  • 3,570
  • 12
  • 59
  • 95
Robert
  • 9
  • 2

1 Answers1

-1

My guess: the connection failed. The result then will be false (boolean).
In consequence, mysql_query($con, …) tries to use a connection handle which is false.
The manual says:

Returns FALSE on failure. For successful SELECT, SHOW, DESCRIBE or EXPLAIN queries mysqli_query() will return a mysqli_result object. For other successful queries mysqli_query() will return TRUE.

$con = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname);
if ($con===false) {
    echo 'Connection failed (' . $con->connect_errno . '): ' . $con->connect_error;
    exit(1);
}
$result = mysqli_query($con, "SELECT * FROM `settings`");
if ($result===false) {
    echo 'Selection failed :' . $con->error;
    exit(2);
}
$settings = mysqli_fetch_array($result);
// ...

So, you should look at your includes include 'db.php' and include 'dbc.php', which define the connection parameters.

hherger
  • 1,660
  • 1
  • 10
  • 13