include_once [SOLVED]

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
ov10fac
Forum Newbie
Posts: 2
Joined: Sun Feb 05, 2012 10:11 pm

include_once [SOLVED]

Post by ov10fac »

I have code that doesn't seem to work. I am using three include_once statements to bring in variables and common dbase connections.

It works fine on Godaddy, but not on my local site. The files are being included, (they show up when I do a "view source" from the browser. However, it seems the variables are going out of scope at the end of the included file. I know that because when I add a print statement to print out a variable I get an undefined variable error.

I've done a lot of Google searches, but no satisfactory answer for this particular problem.

Any ideas? thanks.
ov10fac
Forum Newbie
Posts: 2
Joined: Sun Feb 05, 2012 10:11 pm

Re: include_once

Post by ov10fac »

Solved.

The file was written with <? at the beginning instead of <?php. Once I added php to the files, everything works fine.
Post Reply