PHP PEAR bug fix

I am trying to connect to a MYSQL database and cannot. I believe this has something to do with the PEAR error, and I looked at this answer, but it was useless.

Getting PEAR to work on XAMPP (Apache / MySQL stack on Windows)

My code is as follows:

require 'DB.php';
require 'formhelpers.php';

$db = DB::connect('mysql://root:password@localhost/test');
if (DB::isError($db)) { die("connection error: " . $db->getMessage( )); }
$db->setErrorHandling(PEAR_ERROR_DIE);

//create table for responses 
$q = $db->query(
    "CREATE TABLE apiResponse(
    Name VARCHAR(20),
    Occupation VARCHAR(20)");

//select data to send
$db = DB::connect('mysql://root:password@localhost/test');
$q = $db->query('SELECT Name, Occupation FROM try2 ');
while ($row = $q->fetchRow())
{
$Name = $row[0];
$Occupation = $row[1];

$q = $db->query(
"INSERT INTO apiResponse (Name, Occupation) values ($Name, $Occupation)"
);

And I get the following errors:

Warning: require (formhelpers.php) [function.require]: could not open the stream: there is no such file or directory in C: \ xampp \ htdocs \ myfiles \ Testing API Script.php on line 10

Fatal error: require () [function.require]: Failed to open "formhelpers.php" (include_path = '; C: \ xampp \ php \ PEAR') in C: \ xampp \ htdocs \ myfiles \ Testing API Script.php in line 10

, , PEAR. php.ini include. PHP: include. Path.

:

  • , , php.ini xamp? ( php php.net)

  • php.ini , ..., ?

  • .ini , , . ?

+2
1

,

include_path ".;/path/to/php/pear", .

. XAMPP , . \Xampp\php\PEAR, , xampp default PEAR.

. . PEAR XAMPP (Apache/MySQL Windows) , .

0

All Articles