Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我的查询语法中有错误_Php_Mysql_Pdo - Fatal编程技术网

Php 我的查询语法中有错误

Php 我的查询语法中有错误,php,mysql,pdo,Php,Mysql,Pdo,诚然,我已经有一段时间没有接触MYSQL了,所以如果这是一个简单的错误,请原谅我。我试图使用PDO查询插入数据,但我得到了这个错误 Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that cor

诚然,我已经有一段时间没有接触MYSQL了,所以如果这是一个简单的错误,请原谅我。我试图使用PDO查询插入数据,但我得到了这个错误

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access     violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ( '', '/dYtAyg4vD88hIfrR1VKDnVGhnE6.jpg', '106646', 'The'  
这是我的问题

$query = $db->prepare("INSERT INTO `cache_movies` (
        api_adult, 
        api_backdrop_path, 
        api_id, 
        api_original_title, 
        api_release_date, 
        api_poster_path, 
        api_popularity, 
        api_title, 
        api_video, 
        api_vote_average, 
        api_vote_count, 
    ) VALUES (
        :api_adult, 
        :api_backdrop_path, 
        :api_id, 
        :api_original_title, 
        :api_release_date, 
        :api_poster_path, 
        :api_popularity, 
        :api_title, 
        :api_video, 
        :api_vote_average, 
        :api_vote_count, 
    )");
$query->execute(array(
    ':api_adult' => $results['results'][0]['adult'],
    ':api_backdrop_path' => $results['results'][0]['backdrop_path'],
    ':api_id' => $results['results'][0]['id'],
    ':api_original_title' => $results['results'][0]['original_title'],
    ':api_release_date' => $results['results'][0]['release_date'],
    ':api_poster_path' => $results['results'][0]['poster_path'],
    ':api_popularity' => $results['results'][0]['popularity'],
    ':api_title' => $results['results'][0]['title'],
    ':api_video' => $results['results'][0]['video'],
    ':api_vote_average' => $results['results'][0]['vote_average'],
    ':api_vote_count' => $results['results'][0]['vote_count']
));

我使用了一个在线SQL验证器,它说错误在值所在的行上?

删除这些行末尾的逗号:

 api_vote_count, 


您必须删除这些逗号:

:api_vote_count,