mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables and cannot UPDATE

前端 未结 2 1388
萌比男神i
萌比男神i 2021-01-29 10:44

I have a problem when i submit or update this data. The data cannot update.

this code :

if(isset($_GET[\'newsid\'])){
    if(isset($_POST[\'submit\'])){
         


        
2条回答
  •  忘掉有多难
    2021-01-29 11:25

    Looking at your SQL Update statement

    UPDATE news  set title =?, short_desc =?, isi =?, author =?, status =?, category =? WHERE newsid =?
    

    I can count 7 parameters. When I look at your bind_param call

    $sql->bind_param('aaaaa', 
         $title,$short_desc,$isi,$author,$status,
         $date_period_start, $date_period_end, $category);
    

    I count 5 type characters ('aaaaa') and 8 parameters ($title, $short_desc, $isi, $author, $status, $date_period_start, $date_period_end, $category). These all need to match. Reading this might help.

提交回复
热议问题