# Fatal error: Uncaught Error: Call to a member function prepare()

**URL:** <https://www.phphelp.com/t/fatal-error-uncaught-error-call-to-a-member-function-prepare/32940>\
**Category:** General PHP Help\
**Created:** [December 17, 2020, 10:02am UTC](https://www.phphelp.com/t/fatal-error-uncaught-error-call-to-a-member-function-prepare/32940 "2020-12-17T10:02:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vaquita](https://www.phphelp.com/user_avatar/www.phphelp.com/vaquita/32/3423_2.png) [@Vaquita](https://www.phphelp.com/u/Vaquita)\
**Post date:** [December 17, 2020, 10:02am UTC](https://www.phphelp.com/t/fatal-error-uncaught-error-call-to-a-member-function-prepare/32940/1 "2020-12-17T10:02:28Z")

</div>

MY ERROR IS POINTING TO THE CODE BLOCK BELOW

public function query($query){  
$this-\>stmt = $this-\>dbh-\>prepare($query);  
}

---

<div class="post-metadata">

**Author:** ![phdr](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/91b2a8/32.png) [@phdr](https://www.phphelp.com/u/phdr)\
**Post date:** [December 17, 2020, 10:45am UTC](https://www.phphelp.com/t/fatal-error-uncaught-error-call-to-a-member-function-prepare/32940/2 "2020-12-17T10:45:28Z")

</div>

2 posts were merged into an existing topic: [Fatal error: Uncaught Error: Call to a member function prepare() on line 31](https://www.phphelp.com/t/fatal-error-uncaught-error-call-to-a-member-function-prepare-on-line-31/32939)

---

<div class="post-metadata">

**Author:** ![phdr](https://www.phphelp.com/letter_avatar_proxy/v4/letter/p/91b2a8/32.png) [@phdr](https://www.phphelp.com/u/phdr)\
**Post date:** [December 17, 2020, 10:45am UTC](https://www.phphelp.com/t/fatal-error-uncaught-error-call-to-a-member-function-prepare/32940/3 "2020-12-17T10:45:28Z")

</div>


