PEAR Forum :: PHP Extension and Application Repository

PEAR Forum Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
Unknown DataSource driver. Please specify an existing driver

 
Post new topic   Reply to topic    PEAR Forum Forum Index -> Structures
View previous topic :: View next topic  
Author Message
VinkoCM



Joined: 03 Jul 2009
Posts: 2

PostPosted: Fri Jul 03, 2009 5:34 pm    Post subject: Unknown DataSource driver. Please specify an existing driver Reply with quote

Situation:

I am creating a database user interface for a client's website. I know I could simply use phpMyAdmin, but it is too complex for my client. Instead, I though I could give some of the PEAR Packages a try. After doing some research and following tutorials I decided to go with the Structures_DataGrid package. I am currently following sitepoint.com's book, 'The PHP Anthology'. It contains some great tutorials.

Error:

First of all, I had some difficulty installing the packages so I ended up downloading them from the PEAR website and inserting them int he server via FTP. After all that was setup, I followed the book's instructions to the last semicolon. But i get this error: Unknown DataSource driver. Please specify an existing driver. I have no idea where this error is coming from or why.

Code:

Code:
<?php

    // Include PEAR::Structures_DataGrid
    include('Structures/DataGrid.php');

    $datagrid = new Structures_DataGrid(2);
    $options = array('dsn' => 'mysql://$user:$passwords@$db_host/$db_name');
    $sql = "SELECT * FROM Users";
    $bind = $datagrid->bind($sql, $options);
    if (PEAR::isError($bind))   {
        print('DataGrid Error: '. $bind->getMessage());
        $gridsource = '';
    } else {

        // Define our Column labels, using a 'column' => 'Label' format
        $columns = array(
                'id' => 'Id',
                'status' => 'Status',
                'last_login' => 'Last Login',
                'startDate' => 'Start Date',
                'fname' => 'First Name',
                'lname' => 'Last Name',
                'email' => 'Email',
                'cName' => 'Company',
                'cEmail' => 'Company Email',
                'cCity' => 'City',
                'cProvince' => 'Province',
                'ctr' => 'Country',
                'cSite' => 'Website'                   
        );
        $datagrid->generateColumns($columns);

        // Some more options, for our renderer
        $renderer_options = array(
                'sortIconASC' => '&uArr;',
                'sortIconDESC' => '&dArr;',
                'headerAttributes' => array('bgcolor' => '#E3E3E3'),
                'evenRowAttributes' => array('bgcolor' => '#A6A6A6'),
        );
        $datagrid->setRendererOptions($renderer_options);

        // Add some final attributes to our table
        $renderer = $datagrid->getRenderer();
        $renderer->setTableAttribute('cellspacing', 0);
        $renderer->setTableAttribute('cellpadding', 5);
        $renderer->setTableAttribute('border', 1);

        // Render the table, be sure to check for errors
        $gridbody = $datagrid->getOutput();
        if (PEAR::isError($gridbody)) {
                print('DataGrid render error: ' . $gridbody->getMessage());
                $gridbody = '';
        }

        // Finally, render the pager, again checking for errors
        $gridpager = $datagrid->getOutput(DATAGRID_RENDER_PAGER);
        if (PEAR::isError($gridpager)) {
                print('DataGrid render error: ' . $gridpager->getMessage());
                $gridpager = '';
        }
        $gridsource = $gridbody . $gridpager;
    }

?>


Comments:

All of my database credentials are correct. I am trying to connect to a MySQL database on a Unix server. I am sure I have all the required packages. I do not think that the error is here in the code. Rather it is an issue with the driver not being enabled or something like that.

Question:

Well, I am not sure what my question is because I am not sure what my problem is. I could ask things like 'How do I specify a driver?', 'How do I enable/activate/include a driver?' or 'Has anybody had to dealt with these issues before, and what did you do?'

Any help would be greatly appreciated, thanks in advance.
Back to top
View user's profile Send private message
VinkoCM



Joined: 03 Jul 2009
Posts: 2

PostPosted: Fri Jul 03, 2009 6:25 pm    Post subject: It works now Reply with quote

I used the go-pear.php system to re-install everything and it all works fine.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    PEAR Forum Forum Index -> Structures All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



PEAR Forum topic RSS feed 
Powered by phpBB © 2001, 2005 phpBB Group

Provided by Ministry of Web developement

'Actiemonitor' online projectmanagement software