Jump to content

Recommended Posts

Hi..

 

I want to use the pear package.Pear is already on my xampp package.On the file php.ini the pear is included(I didn't change the file php.ini..there is a line like include_path = ".;C:\xampp\php\pear\"

.I used the following code to retrieve the results from database..But it is not working ..

 

<?php

PHP Syntax // Include the appropriate PEAR classes

require_once("DB.php");

 

$dsn = array(

'phptype'  => 'mysql',

'hostspec' => 'localhost',

'database' => 'emp',

'username' => 'root',

'password' => 'mysql'

);

$dbh = DB::connect($dsn);

 

$stmt = "SELECT id, name FROM examples ORDER BY id";

$result = $dbh->simpleQuery($stmt, DB_FETCHMODE_ASSOC);

if ($dbh->numRows($result) > 0) {

$data = (object) $dbh->fetchRow($result, DB_FETCHMODE_ASSOC);

echo "id  => $data->id<br>\n";

echo "name => $data->name<br>\n";

}

 

 

 

 

?>

 

 

 

 

 

showing the errors like following ...

 

 

 

Warning: require_once(DB.php) [function.require-once]: failed to open stream: No such file or directory in C:\xampp\htdocs\divya\Pear-examples\dbconnect.php on line 3

 

Fatal error: require_once() [function.require]: Failed opening required 'DB.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\divya\Pear-examples\dbconnect.php on line 3

 

 

 

 

 

What should I do..Shall I install the Pear package se-perately?How should I configure it?Plz Help me.....

Link to comment
https://forums.phpfreaks.com/topic/213867-pear-on-xampp/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.