-1

I moved to a new server and now my script throws these errors:

PHP Warning: mysqli_query() expects at least 2 parameters, 1 given in /admin/classes/db_functionsClass.php on line 57

PHP Fatal error: Uncaught Error: Call to undefined function mysql_error() in /admin/classes/db_functionsClass.php:57 Stack trace:\n#0 /admin/index.php(45): db_functionsClass->selectQuery('tbl_adminuser', 'where username=...')

This is line 57:

$this->result=mysqli_query($this->query) or die(mysql_error());

And line 45 from index file

$db->selectQuery($table,$condition);  // Executing Select Query.

And the whole function from db_function:

    function selectQuery($table,$condition,$fields="")
    {
        if(trim($fields)=="")
                $fields="*";
        $this->query="select $fields from $table $condition";
        $this->result=mysqli_query($this->query) or die(mysql_error());
        if($this->result)
        $this->num=mysql_num_rows($this->result);    
    }
Community
  • 1
  • 1
Michael
  • 1
  • 1

1 Answers1

0

Look more carefully to article mysqli::query mysqli_query There are 2 forms object-oriented and procedural. Library needs to know on which DB connection issue commands. In OO case opened connection is holding inside object, while in procedural style you should pass it at first param. Here you are trying to use procedural function mysqli_query in OO way.
Try to rewrite mysqli_query($this->query) like procedural:
mysqli_query($sql_link, $this->query)
or OO:
$this->mysqli_object->query($this->query) Look to examples in manual!