Problem on include

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
tgckpg
Forum Newbie
Posts: 7
Joined: Sun Feb 07, 2010 11:09 am

Problem on include

Post by tgckpg »

b.php
<?php
$root = 'C:\';
?>

a.php
<?
include 'b.php';
echo $root;
?>

on commandline:
C:\cmdUtilities>php a.php
PHP Warning: Directive 'register_globals' is no longer supported in PHP 6 and g
reater in Unknown on line 0
PHP Warning: Directive 'register_long_arrays' is no longer supported in PHP 6 a
nd greater in Unknown on line 0
PHP Warning: Directive 'magic_quotes_gpc' is no longer supported in PHP 6 and g
reater in Unknown on line 0

Parse error: syntax error, unexpected $end in C:\cmdUtilities\b.php on line 2

Why I'm getting this error?
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: Problem on include

Post by klevis miho »

are a.php and b.php in the same folder?
I would use include('b.php'); rather than include 'b.php';
tgckpg
Forum Newbie
Posts: 7
Joined: Sun Feb 07, 2010 11:09 am

Re: Problem on include

Post by tgckpg »

thanks for replying!
I'm really hoping helps for this.(worrying if no one answered)

Yes,they are in the same folder.
As you see, then error shown "in b.php"
and I'm running a.php (ie,php checks b.php through a.php)

I'd tried "include" with brackets, without brackets, " and ' .
but it still reporting the error.

Why?
klevis miho
Forum Contributor
Posts: 413
Joined: Wed Oct 29, 2008 2:59 pm
Location: Albania
Contact:

Re: Problem on include

Post by klevis miho »

Paste all the code here
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Problem on include

Post by AbraCadaver »

Code: Select all

$root = 'C:\\';
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
tgckpg
Forum Newbie
Posts: 7
Joined: Sun Feb 07, 2010 11:09 am

Re: Problem on include

Post by tgckpg »

AbraCadaver wrote:

Code: Select all

$root = 'C:\\';
Oh, thanks!This works!
But I feel dumb for such "changes"...
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Problem on include

Post by AbraCadaver »

tgckpg wrote:
AbraCadaver wrote:

Code: Select all

$root = 'C:\\';
Oh, thanks!This works!
But I feel dumb for such "changes"...
That line was generating a parse error, because the \ was escaping the ' and so there was no closing '

Use this when developing:

Code: Select all

error_reporting(E_ALL);
ini_set('display_errors', '1');
Or set these in php.ini on the development machine.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Post Reply