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
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.