Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 267879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T23:37:03+00:00 2026-05-11T23:37:03+00:00

Situation: I am creating a database user interface for a client’s website. I know

  • 0

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

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T23:37:04+00:00Added an answer on May 11, 2026 at 11:37 pm

    I really do not have an answer, just an update.

    I uninstalled everything and cleaned out the PHP directory on my server. I then downloaded the go-pear.php script and reinstalled everything.

    Now everything works fine! Yay!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 266k
  • Answers 266k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Well, seems like a really smart idea at first. But… May 13, 2026 at 12:38 pm
  • Editorial Team
    Editorial Team added an answer This is what the BackgroundWorker class is made for. The… May 13, 2026 at 12:38 pm
  • Editorial Team
    Editorial Team added an answer You could build a helper object, but I would refactor… May 13, 2026 at 12:38 pm

Related Questions

Situation: I am creating a database user interface for a client's website. I know
This is a question related to how people are handling a situation in the
Here's the lowdown of the situation. I am creating a role-playing game with PHP.
This is the situation I am facing. I have developed a web application that
Greetings! I'm creating a User Control that will display data in a GridView control.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.