PDO Database access WHERE title = $title

后端 未结 5 1450
無奈伤痛
無奈伤痛 2021-01-26 15:03

I\'m trying to learn to use PDO instead of MySQLi for database access and I\'m having trouble selecting data from the database. I want to use:

$STH = $DBH->qu         


        
5条回答
  •  北荒
    北荒 (楼主)
    2021-01-26 15:38

    remove the variable out of the sql statement because its a php variable

    $STH = $DBH->query('SELECT * FROM ratings WHERE title=' . $title . 'ORDER BY date ASC');
    

提交回复
热议问题