Re: Mysqli insert / OO Design Problem - Call to a member function bind_param() on a non-object in...
| From: | Robin Vickery | Date: | Thu, 17 May 2007 08:22:13 +0000 |
| Subject: | Re: Mysqli insert / OO Design Problem - Call to a member function bind_param() on a non-object in... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-255050@lists.php.net to get a copy of this message | ||
On 16/05/07, Lee PHP <leephp@gmail.com> wrote:
/** Insert record. */
public function insert() {
$sql = "INSERT INTO table (" .
"field_1, " .
"field_2, " .
"field_3) " .
"?, " .
"?, " .
"?)";
echo "Server version: " . self::$conn->server_info;
$stmt = self::$conn->prepare($sql);
$stmt->bind_param('sssssssssssss',
$this->getField1(),
$this->getField2(),
$this->getField3());
Server version: 5.0.21-Debian_3ubuntu1-log Fatal error: Call to a member function bind_param() on a non-object in C:\blah\blah\blahYou've missing an open bracket in your INSERT statement. This is causing your prepare() to fail, returning FALSE rather than a statement object. You then call bind_param() on that and because it's not an object you get the fatal error. -robin