php - Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables 11 -
my code against sql injection isn't working (error message in title).
i simplified code, still not working.
<?php include "conf.php"; $db = new mysqli($mysql_host, $mysql_user, $mysql_pass, $mysql_db); $ltime =10; $url= 1; $title =2; $result = $db->prepare("insert links values ('', ?, ?, ?)"); $result->bind_param('ss', $url, $title, $ltime); $result->execute();
i created db , variables integer, first value id , created auto increment flag.
you have put 3 "s" in bind_param method, because there 3 variables bind
$result = $db->prepare("insert links values (null, ?, ?, ?)"); $result->bind_param('sss', $url, $title, $ltime);
i's better pass null null value autoincremented field instead of empty string
Comments
Post a Comment