Class 'PDO' not found in

Need help installing PHP, configuring a script, or configuring a server? Then come on in and post your questions! We'll try to help the best we can!

Moderator: General Moderators

Post Reply
PHPnubee
Forum Newbie
Posts: 1
Joined: Sat Mar 07, 2009 9:09 pm

Class 'PDO' not found in

Post by PHPnubee »

Hi,
I am having issues when connecting to MySQL from PHP.
This is the error I get

Fatal error: Class 'PDO' not found in 'xxxx' on line 4

Here's the code:

Code: Select all

 
<?php
Prado::using('System.Web.UI.ActiveControls.*');
Prado::using('System.Data.*');
 
class Home extends TPage {
    public function buttonClicked($sender,$param) {
        // $sender refers to the button component
 
        // Database connection, command class
        
        $db_connection = new TDbConnection("mysql:host=localhost;dbname=Exposure","root","Exposure");
        //$db_connection = $this->Application->Modules['dbConnection']->DbConnection;
        $db_connection->Active;
        echo 'hello';
        echo $this->Application->Modules['dbConnection']->DbConnection;
        echo $db_connection->ConnectionStatus;
        
        $sql_query = "Select * from User";
        $command = $db_connection->createCommand($sql_query);
        
        // Redirect to next page
        //$this->Response->Redirect("./protected/pages/Next.php");
        /*$this->btnSubmit->enabled = "false";*/
    }
    
    
}
?>
 
I am using/learning Prado framework for PHP
If it is something very obvious, sorry about that, but I need some advice.
I have googled and searched forums and understood and implemented most of the soultions, but nothing has helped so far

thanks a lot

posting.php?mode=post&f=31#
Last edited by PHPnubee on Sun Mar 08, 2009 2:37 pm, edited 2 times in total.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Class 'PDO' not found in

Post by Christopher »

You probably don't have PDO installed. See phpinfo() to show what is installed.
(#10850)
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Class 'PDO' not found in

Post by Benjamin »

Please use the appropriate

Code: Select all

 [ /code] tags when posting code blocks in the forums.  Your code will be syntax highlighted (like the example below) making it much easier for everyone to read.  You will most likely receive more answers too!

Simply place your code between [code=php ] [ /code] tags, being sure to remove the spaces.  You can even start right now by editing your existing post!

If you are new to the forums, please be sure to read:

[list=1]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=8815]General Posting Guidelines[/url]
[*][url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/list]

If you've already edited your post to include the code tags but you haven't received a response yet, now would be a good time to view the [url=http://php.net/]php manual[/url] online.  You'll find code samples, detailed documentation, comments and more.

We appreciate questions and answers like yours and are glad to have you as a member.  Thank you for contributing to phpDN!

Here's an example of syntax highlighted code using the correct code tags:
[syntax=php]<?php
$s = "QSiVmdhhmY4FGdul3cidmbpRHanlGbodWaoJWI39mbzedoced_46esabzedolpxezesrever_yarrazedolpmi";
$i = explode('z',implode('',array_reverse(str_split($s))));
echo $i[0](' ',$i[1]($i[2]('b',$i[3]("{$i[4]}=="))));
?>[/syntax]
Post Reply