0

Hello guys,
I have been trying to fix these errors, but it wont work. This are the errors im getting
Warning: mysqli_query() expects parameter 1 to be mysqli, object given in /home/335456/public_html/hoi/class.user.php on line 35

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /home/335456/public_html/hoi/class.user.php on line 36
This is the code where the error appears, does anyone know what i'm doing wrong?

  /*** for login process ***/
  public function check_login($emailusername,$password){ 
  $password = md5($password);
  $sql2="SELECT userid from users WHERE username='$emailusername' or email='$emailusername' and password='$password'";

  //checking if the username is available in the table
  $result = mysqli_query($this->db,$sql2);
  $user_data = mysqli_fetch_array($result);
  $count_row = $result->num_rows;
2
Contributors
3
Replies
18
Views
1 Year
Discussion Span
Last Post by pritaeas
0
$DB_host = "mydetails";
$DB_user = "mydetails";
$DB_pass = "mydetails";
$DB_name = "mydetails";

try
{
     $DB_con = new PDO("mysql:host={$DB_host};dbname={$DB_name}",$DB_user,$DB_pass);
     $DB_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
     echo $e->getMessage();
}


include_once 'class.user.php';
$user = new USER($DB_con);

and this is the function

 private $db;

   public function __construct($DB_con)
    {
      $this->db = $DB_con;
    }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.