Re: Mysqli insert / OO Design Problem - Call to a member function bind_param() on a non-object in...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16/05/07, Lee PHP <leephp@xxxxxxxxx> 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\blah

You'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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux