PHP错误无效参数编号:绑定变量的数量与令牌的数量不匹配
我得到的错误参数编号无效:绑定变量的数量与第51行/home/200228935/public_html/PHPWebServer/saveVideoGame.php中的令牌数量不匹配PHP错误无效参数编号:绑定变量的数量与令牌的数量不匹配,php,database,parameters,numbers,token,Php,Database,Parameters,Numbers,Token,我得到的错误参数编号无效:绑定变量的数量与第51行/home/200228935/public_html/PHPWebServer/saveVideoGame.php中的令牌数量不匹配 $sql = 'INSERT INTO videogame(developer, name, cost, genre) VALUES(:developer,:name,;cost,:genre)'; //Allows special characters and sli
$sql = 'INSERT INTO videogame(developer, name, cost, genre)
VALUES(:developer,:name,;cost,:genre)';
//Allows special characters and slims the chance SQL injection
$cmd=$conn->prepare($sql);
$cmd->bindParam(':developer',$developer,PDO::PARAM_STR,50);
$cmd->bindParam(':name',$name,PDO::PARAM_STR,50);
$cmd->bindParam(':cost',$cost,PDO::PARAM_INT);
$cmd->bindParam(':genre',$genre,PDO::PARAM_STR,50);
$cmd->execute();
第51行是$cmd->execute() 改变
;成本
至:成本
在
$sql
字符串中,它看起来像一个打字错误。SQL字符串中的一个占位符前缀与其他占位符前缀不同。