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

前端 未结 2 1360
萌比男神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:14

    aaaa in the bind parameters is not valid, it needs to be s for string or i for integer or d for double

    0 讨论(0)
  • 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.

    0 讨论(0)
提交回复
热议问题