Fatal PHP error, pear?

I started with these questions:

PHP PEAR bug fix

And I went with what was suggested, but that doesn't seem to work.

Now my code 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 required "C: \ Users \ Desktop \ formhelpers.php"; 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

Since the directory did not solve the problem, I think my previous questions about modifying the PEAR file may be relevant.

My questions:

File to fix is ​​php.ini file in xamp? (I previously downloaded php directly from php.net)

I have both php.ini for development and for production ... which I am editing?

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

+5
source share
1 answer
$q = $db->query(
"CREATE TABLE apiResponse(
 Name VARCHAR(20),
 Occupation VARCHAR(20)");

missing last bracket.

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

All Articles