On 13 Dec 2009, at 10:18am, FrankLane wrote:

> After the loop that inserts the data
> into the databease,

I would like to be sure that your INSERT commands work correctly.  Once you 
have executed the code that puts data in the database, please open the same 
database in the command-line tool (sqlite3) and check to see that the contents 
of your table look vaguely right.

> I'm using the following code to try to execute an sqlite
> commmand:
> 
> $sth = $dbHandle->prepare("select * from tab where i0=2");
> $sth->execute();
> 
> and I get the following error:
> 
> Fatal error: Call to a member function execute() on a non-object in
> /Library/WebServer/Documents/test3.php on line 41

I agree that this does look like it may be a bug in PHP.  However, please check 
to see whether your call to -->prepare is working properly.  For instance 
replace your '-->prepare' with

    try { 
        $sth = $dbHandle->prepare("select * from tab where i0=2");
    } catch (PDOException $PDOError) { 
        echo "Syntax Error: ".$PDOError->getMessage();
    }

Actually I am surprised that ->query is not working for you.  Instead of 
->prepare and ->execute can you try

    try { 
        $sth = $dbHandle->query("select * from tab where i0=2");
    } catch (PDOException $PDOError) { 
        echo "Syntax Error from query: ".$PDOError->getMessage();
    }
    try { 
        $resultInArray = $sth->fetchAll();
    } catch (PDOException $PDOError) { 
        echo "Syntax Error from fetchAll: ".$PDOError->getMessage();
    }
    echo "returned: ".print_r($result,true);

and tell me if you get errors back ?

Warning: There may be bugs in the above code.  It's off the top of my head.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to