I'm using mysqli_prepare() so the thing is I get this error always.
Warning: mysqli_stmt::bind_param(): Number of variables doesn't match number of parameters in prepared statement in download.php on line 12
Fatal error: Uncaught exception 'mysqli_sql_exception' with message 'No data supplied for parameters in prepared statement' in ***gg.php:13 Stack trace: #0 \download.php(13): mysqli_stmt->execute() #1
include('.') #2 {main} thrown in
download.php on line 13
I looked up in other questions but I didn't manage to get the solution.
my code :
if(isset($_GET['cert_id'])){
$cert_id = $_GET['cert_id'];
$stmt1 = mysqli_prepare($connection,"SELECT cert_id,certificate_id,name_student,hours_com,course_title FROM cert JOIN courses WHERE cert_id = ? AND course_id = certificate_id");
$stmt1->bind_param("iisss",$cert_id,$certificate_id,$name_student,$hours_com,$course_title);
$stmt1->execute();
while(mysqli_stmt_fetch($stmt1))
{
$pdf = new \setasign\Fpdi\Fpdi();
$pdf->addPage('L');
$pagecount = $pdf->setSourceFile('cert.pdf');
$tplIdx = $pdf->importPage(1);
$pdf->useTemplate($tplIdx);
$pdf->SetY(-120);
$pdf->SetX(35);
$pdf->SetFont('times', 'B', 35);
$pdf->cell(20, 10,$name_student, 'C');
$pdf->SetY(-135);
$pdf->SetX(135);
$pdf->SetFont('times', 'B', 35);
$pdf->cell(90, 100, $course_title, 'C');
$pdf->SetY(151);
$pdf->SetX(200);
$pdf->AddFont('BOOKOSBI','','BOOKOSBI.php');
$pdf->SetFont('BOOKOSBI','',25);
$pdf->cell(40, 10, $hours_com 'C');
}
$pdf->Output('certnew.pdf','D');
}
line 12 & 13 :
$stmt1->bind_param("iisss",$cert_id,$certificate_id,$name_student,$hours_com,$course_title);
$stmt1->execute();
Any idea what is wrong here?