Warning: call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in C:\xampp\htdocs\project\modules\Sql.php on line 23
call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object in C:\xampp\htdocs\project\modules\Sql.php on line 24
below is the code of Sql.php - <?php
-
abstract class Sql{
-
public static $mysqli=null;
-
public static function init($DB){
-
if(!isSet(self::$mysqli))
-
self::$mysqli=$DB;
-
}
-
public static function query($query,$param_string="",$param_array=array()){//used in void type query like insert,delete,update
-
$stmt=self::$mysqli->prepare($query);
-
array_unshift($param_array,$param_string);
-
if(count($param_array)>1)
-
call_user_func_array(array($stmt,'bind_param'),$param_array);
-
$stmt->execute();
-
$ans=max(self::$mysqli->affected_rows,self::$mysqli->insert_id);
-
$stmt->close();
-
return $ans;
-
}
-
-
public static function getArray($query,$param_string="",$param_array=array()){//used in select type query
-
$stmt=self::$mysqli->prepare($query);
-
array_unshift($param_array,$param_string);
-
if(count($param_array)>1)
-
call_user_func_array(array($stmt,'bind_param'),$param_array);
-
$stmt->execute();
-
$result=$stmt->result_metadata();
-
$row=array();
-
$temp=array();
-
$params=array();//list of location,of some pointer where value of answill come.
-
-
while($field=$result->fetch_field()){
-
$row[$field->name]=null;
-
$params[]=$field->name;
-
$temp[]=&$row[$field->name];
-
}
-
call_user_func_array(array($stmt,'bind_result'),$temp);
-
$out=array();
-
while($stmt->fetch()){
-
$thisRow=array();
-
for($i=0;$i<count($row);$i++){
-
$thisRow[$params[$i]]=$row[$params[$i]];
-
}
-
$out[]=$thisRow;
-
}
-
$stmt->close();
-
return $out;
-
}
-
public static function getArrayLength($query,$param_string="",$param_array=array()){//used in select type query, to know length only
-
$stmt=self::$mysqli->prepare($query);
-
array_unshift($param_array,$param_string);
-
if(count($param_array)>1)
-
call_user_func_array(array($stmt,'bind_param'),$param_array);
-
$stmt->execute();
-
$stmt->store_result();
-
$numRows=$stmt->num_rows;
-
$stmt->close();
-
return $numRows;
-
}
-
}
-
-
?>
the above error is coming on running the project , Please resolve the problem anyone or give some solution.
1 3963
call_user_func_array() expects parameter 1 to be a valid callback, first array member is not a valid class name or object
it’s like in the message, make sure you pass the correct data. and if the logic doesn’t seem off, test the variables to see what they actually contain.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ben |
last post by:
Hi, there.
Recently I was working on a problem where we want to save generic
closures in a data structure (a vector). The closure should work for
any data type and any method with pre-defined...
|
by: dmitry.freitor |
last post by:
Why would someone call a non-static provate member function from
another non-static member function of the same class via the this
pointer?
Thanks.
DF
|
by: nsharma78 |
last post by:
Hi,
I have a code as follows:
class A
{
public:
void print(){cout << "Magic" << endl;}
};
|
by: loudwinston |
last post by:
Hello,
I'm encountering a strange error with PDO. The server is FreeBSD 4.4,
PHP 5.1.2, mySQL 4.0.20 with 4.1.18 client libs.
I have the following code (usernames and passwords changed to...
|
by: tbringley |
last post by:
I am a c++ newbie, so please excuse the ignorance of this question.
I am interested in a way of having a class call a general member
function of another class.
Specifically, I am trying to...
|
by: mahesh |
last post by:
Can anyone direct me to the place where i find the solution for the
error message "cannot call member function 'X' without object"???
thanks in advance
|
by: Elliott |
last post by:
Hello Everyone,
I have a function in a header (KeyDialog.h) as such:
void setKey(Key&);
The function implementation is as such (KeyDialog.cpp):
void KeyDialog::setKey(Key& k1)
{
|
by: Immortal_Nephi |
last post by:
I had a lot of research to see how function pointer works. Sometimes,
programmers choose switch keyword and function in each case block can
be called. Sometimes, they choose ordinary function...
|
by: church7 |
last post by:
Hello,
I wrote the following class:
In this case, the error message was
|
by: randysimes |
last post by:
I am trying to pass uid and pwd to the function CheckPW of the class PWServer.
I receive the error pwclient.cpp:41: error: cannot call member function âint PWServer::CheckPW(const char*, char*)â...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |