PHP Fatal error: Call to a member function execute() on a non-object

后端 未结 1 805
醉梦人生
醉梦人生 2021-01-25 08:32

I get the error PHP Fatal error: Call to a member function execute() on a non-object refering to the ....->execute() line whenever I call something li

1条回答
  •  没有蜡笔的小新
    2021-01-25 09:07

    The key is the behaviour of PDO::prepare():

    If the database server successfully prepares the statement, PDO::prepare() returns a PDOStatement object. If the database server cannot successfully prepare the statement, PDO::prepare() returns FALSE or emits PDOException (depending on error handling).

    prepare() is somehow failing with your query.

    By default, PDO is mute and does not throw any error messages. See this page to see how to make PDO show errors, and details about what goes wrong.

    0 讨论(0)
提交回复
热议问题