FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PEAR DB: "PHP Fatal error: Call to undefined method DB::query()"
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
PEAR DB: "PHP Fatal error: Call to undefined method DB::query()" [message #180207] Tue, 29 January 2013 09:03 Go to previous message
Robert S is currently offline  Robert S
Messages: 2
Registered: January 2013
Karma:
Junior Member
I have the following code:

<?php
require_once( 'DB.php' );
$dsn = 'mysql://user:password@localhost/table';
$dbh = new DB();
$dbh->connect( $dsn );
if ( $dbh->isError( $dbh )) die ( $dbh->getMessage );
$query = "SELECT * FROM Table ORDER BY Date LIMIT 1";
$sth = $dbh->query( $query );
?>

I get:

PHP Fatal error: Call to undefined method DB::query()

Can somebody tell me where I am going wrong? This all worked using my old code, but I got a lot of warnings about non static methods being called statically:

$dbh = DB::connect( $dsn );
if ( DB::isError( $dbh )) die ( $dbh->getMessage );
$sth = $dbh->query( $query );
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: my blog
Next Topic: Formatting a number
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 11:14:41 GMT 2024

Total time taken to generate the page: 0.04622 seconds