Following error in php while running through localhost
Warning: mysqli_select_db() expects parameter 1 to be mysqli, string given in C:\xampp\htdocs\IVPORTAL\admin\include\database.php on line 9
Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\IVPORTAL\admin\include\database.php on line 9
i didn't get the error.
<?php
require_once("config.php");
class database {
private $link;
function __construct() {
$this->link = mysqli_connect(config::host,config::username,config::password);
mysqli_select_db(config::database,$this->link) or die(mysqli_error());
}
function __distruct() {
mysqli_close($this->link);
}
from the error it looks like you have missing params for function mysqli_error
following is syntax to use mysqli_error
mysqli_error(connection);
//change it to following
mysqli_error($this->link)
for the reference i have update your code
require_once("config.php");
class database {
private $link;
function __construct() {
$this->link = mysqli_connect(config::host,config::username,config::password);
mysqli_select_db(config::database,$this->link) or die(mysqli_error($this->link));
}
function __distruct() {
mysqli_close($this->link);
}
it should work
I think you are pass parameter in wrong order
Connection come according to docs
if this not help you share you connection file or sample code you write