php - Parameter expected warning -
i have following warning when run code:
call_user_func() expects parameter 1 valid callback, function 'db_connect' not found or invalid function name
the code:
require_once("mo_object.php"); class mo_model extends mo_object { private $con; static function db_query($qry) { $this->db_connect; return $qry; } function db_connect() { $con = mysqli_connect($rconf['host'],$mo_conf['usr'],$mo_conf['password'],$mo_conf['da tabase']); } }
why can't run db_connect function correctly?
thanks.
if class , these functions both in same class, try this:
static function db_query($qry) { $this->db_connect(); return $qry; } public function db_connect() { $con = mysqli_connect($rconf['host'],$mo_conf['usr'],$mo_conf['password'],$mo_conf['database']); }
Comments
Post a Comment