PEAR Packages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPEAR Packages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old July 3rd, 2009, 11:29 AM
VinkoCM VinkoCM is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jul 2009
Posts: 2 VinkoCM User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 42 sec
Reputation Power: 0
Unknown DataSource driver. Please specify an existing driver.

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:

PHP 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.

Reply With Quote
  #2  
Old July 3rd, 2009, 12:25 PM
VinkoCM VinkoCM is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Jul 2009
Posts: 2 VinkoCM User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 42 sec
Reputation Power: 0
Everything works now

I used the go-pear.php system to re-install everything and it all works fine.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPEAR Packages > Unknown DataSource driver. Please specify an existing driver.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
Stay green...Green IT