user1459268
user1459268

Reputation: 227

Fatal Error PHP, Pear?

I started with this questions:

Fixing PHP PEAR error

And I went with what was suggested, but that does not appear to work.

My code now looks like this:

require 'DB.php';
require 'C:\Users\Clayton\Desktop\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)"
);

Where require 'C:\Users\Desktop\formhelpers.php'; is line 10.

I still get a similar error:

Warning: require(C:\Users\Desktop\formhelpers.php) [function.require]: failed to 
open stream: No such file or directory in C:\xampp\htdocs\myfiles\Testing API 
Script.php on line 10

Fatal error: require() [function.require]: Failed opening required 
'C:\Users\Clayton\Desktop\formhelpers.php' 
(include_path='.;C:\xampp\php\PEAR') in 
C:\xampp\htdocs\myfiles\Testing API Script.php on line 10

Because the directory did not solve the problem I'm thinking my previous questions about editing the PEAR file may be relevant.

My questions:

The file that needs to be corrected is the php.ini file in xamp? (I previously downloaded php straight from php.net)

I have both a php.ini for development and for production... which one do I edit?

The .ini file opens in notepad, I'm not sure this is the correct place to edit it. Confirmation?

Upvotes: 5

Views: 782

Answers (1)

jcho360
jcho360

Reputation: 3759

$q = $db->query(
"CREATE TABLE apiResponse(
 Name VARCHAR(20),
 Occupation VARCHAR(20)");

there is missing the last parenthesis.

$q = $db->query(
"CREATE TABLE apiResponse(
 Name VARCHAR(20),
 Occupation VARCHAR(20))");

Upvotes: 1

Related Questions