PDO Database access WHERE title = $title

后端 未结 5 1447
無奈伤痛
無奈伤痛 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条回答
  •  梦毁少年i
    2021-01-26 15:42

    Use double quotes instead of single quotes as a parameter of the query-method.

    The reason you're getting this error is because the query-method fails and so the $STH object isn't created. You should implement some error handling.

提交回复
热议问题