keenyounglearner Posted June 6, 2009 Share Posted June 6, 2009 HI there, I am having trouble understanding how this function works and am getting the error: Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of variables doesn't match number of parameters in prepared statement in file.php on line 65 -1 $thesql ="INSERT INTO `table` (`id` ,`name` ,`third`) VALUES (NULL, '$name', '$third');"; if ($stmt = $thesql ->prepare($thesql)) { $stmt->bind_param("ss", $name2, $third); $stmt->execute(); } How does this work, do I need to have a "s" or "i" for a NULL value? Link to comment https://forums.phpfreaks.com/topic/161194-mysqli-stmt-bind_param/ Share on other sites More sharing options...
gevans Posted June 6, 2009 Share Posted June 6, 2009 Your code is currently using $thesql as an object, though you're clearly setting it as a string on the lines before; Where do you instantiate your mysqli object? and to waht variable is it assigned? Link to comment https://forums.phpfreaks.com/topic/161194-mysqli-stmt-bind_param/#findComment-850584 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.