我试图在准备语句中传递我的两个变量,实际上我不能传递两个变量,我的代码有错误:
Warning: mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of variables doesn't match number of parameters in prepared statement in /Applications/XAMPP/xamppfiles/htdocs/admin/genre.php on line 4
Fatal error: Call to a member function close() on a non-object in /Applications/XAMPP/xamppfiles/htdocs/admin/genre.php on line 9
这是我的代码:
<?php
include("../db_inc.php");
if($stmt=$connection->prepare("INSERT INTO genre(genre_name,genre_desc) VALUES('?','?')")){
$stmt->bind_param('sd',$genre_name,$genre_desc);
$genre_name =$_POST["genre_name"];
$genre_desc =$_POST['genre_desc'];
$stmt -> execute();
$stmt -> close();
$mysqli -> close();
}
$result=mysql_query($qry) or die(mysql_error());
if("$result"){
echo "Add Successfully";
}
?>