Hello,
I try to create a generic binding mysqli function.
My code is:
$pre_sql = "insert into tbl_jobs (job_name,status) values (?,?)";
$string_type = 'si';
$data = "$p_title,1";
$db->pre_sql($pre_sql,$string_type,$data);
function pre_sql($Query_string,$string_type,$data){
$this->connect();
$this->stmt = mysqli_stmt_init($this->Link_ID);
if (mysqli_stmt_prepare($this->stmt,$Query_string)){
mysqli_stmt_bind_param($this->stmt,$string_type,$data);
mysqli_stmt_execute($this->stmt);
}
}
the problem is that mysqli_stmt_bind_param is expected 2 vars, but I don't know how many I will send.
Is there a way to get around it?
Thanks!