Showing results for 
Show  only  | Search instead for 
Did you mean: 

Mysqli Connection to database is working, query not executing

i have this below code working for db connection

class Database_Properties{
function startConnection(){
return mysqli_connect("localhost","root","pwd","db");
function closeConnection(){
return mysqli_close(mysqli_connect("localhost","root","pwd","db"));
but when i try to execute a mysqli_query its doesnt not return anything, when i try to echo num_row nothing is working out. stuck where and what is work.
                $query = "SELECT * FROM CL_ADMIN WHERE USEREMAIL='$username' AND PASSWORD='$hash'";
                $res= mysqli_query($databaseConnection->startConnection(),$query) or die(mysqli_connect_error($databaseConnection->startConnection())); 
                echo $auth = mysqli_num_rows($res);
                if($auth == 1){
                    header('location: https://domain/path to file/);
                    $error='Username and Passowrd are not matching';
                echo "Coulnt reach remote database";