bind_param() doesn't seem to work

前端 未结 2 1334
日久生厌
日久生厌 2021-01-20 03:36

I have the following code:



        
相关标签:
2条回答
  • 2021-01-20 04:40

    mysqli_stmt_bind_param accepts variables (by reference). You cannot use literals. Change your code to

    $fileSize = 123;
    $stmt->bind_param('ssi', $string1, $string2, $fileSize);
    
    0 讨论(0)
  • 2021-01-20 04:40

    Please try the variable assignment after bind_param(). It is a passed by reference call. So it will work after also.

    $stmt = $db->prepare("INSERT INTO images (filename, mime_type, file_size) VALUES (?, ?, ?)");
    $stmt->bind_param('ssi', $string1, $string2, $num);
    $string1 = 'string 1';
    $string2 = 'string 2';
    $num=123;
    $stmt->execute();
    
    0 讨论(0)
提交回复
热议问题