Saturday, June 23, 2018

mysql - PDO statement error #1064



I am trying to move from PDO quote et PDO prepare and execute, my query is like:




$sql = 'SELECT * FROM nav_top1 WHERE id_top = (SELECT top_fr FROM nav_top WHERE top_fr = :rub ORDER BY top1_order ASC';
echo $sql.'
';
$query = $connexion->prepare($sql);
$query->bindParam(':rub', $rub, PDO::PARAM_INT);
$query->execute();
$list = $query->fetchAll();

foreach ($list as $rs) {
$top1_fr = $rs['top1_fr'];


echo $top1_fr;

}


but I get an error:




[Sat Mar 07 14:08:05 2015] [error] [client 105.156.126.211]
PHP Warning: PDOStatement::execute(): 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 '' at line 1 in /home/www/Fashion/fashion.php on line 9, referer...





Thanks in advance


Answer



missing brace?



top1_order ASC)

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...