Jump to content

Pear on Xampp


divyakrishnan

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.