Jump to content


Photo

*SOLVED* Problems with Include?


  • Please log in to reply
1 reply to this topic

#1 Jessica

Jessica
  • Staff Alumni
  • This is not my name.
  • 8,982 posts
  • LocationDallas, TX
  • Age:26

Posted 09 May 2006 - 02:50 PM

EDIT: Uhm, I have no idea what happened. It wasn't working for hours last night. I looked again just now and it works. So...if anyone wants to take a gander, feel free, but it's working now so I'm good. Sorry!

I have [a href=\"http://doublooncove.net/stalls.txt\" target=\"_blank\"]this php code[/a] saved as stalls.php. I need to display it on several different pages, so I am including it in them.

Here is one page it is included in:
session_start();
include_once('../functions.php');
validate_user();
include_once('../loc_names.php');
$location = $session_loc_id;

if($location != 1){
    header('Location: http://www.doublooncove.net/explore');
    die();
}
include_once('../header.php');
?>
<h1>Top of the Third Pier</h1>
<p>
The infamous third pier of the port of the emerald coast lives up to its reputation. A few gangs of burly sailors shift cargo up the pier while a shifty-eyed man whispers quietly with their stern captain. A weasely merchant tries to sell you a parrot that appears to actually be dead, and you feel a hand tug at your pockets as an old beggar jostles into you. What a great place to do business!</p>
<?
include_once('../stalls.php');
include_once('../footer.php');

The problem is when I view just stalls.php it prints the variables title, till, etc.
When I view it in this page, it prints everything but the variables.

What is wrong?
My goal in replying to posts is to help you become a better programmer, including learning how to debug your own code and research problems. For that reason, rather than posting the solution, I reply with tips and hints on how to find the solution yourself. See below for useful links when you get stuck.

How to Get Good Help: How to Ask Questions | Don't be a help vampire
Debugging Your Code: Debugging your SQL | What does a php function do? | What does a term mean? | Don't see any errors?
Things You Should Do: Normalize Your Data | use print_r() or var_dump()
Lulz: "Functions should not have side effects." - trq

Please take a look at my new PHP/Web Dev blog: The Web Mason - Thanks!!

#2 ober

ober
  • Staff Alumni
  • Advanced Member
  • 5,337 posts
  • LocationEast Coast, USA

Posted 09 May 2006 - 03:02 PM

I will mark this as solved.

Info: PHP Manual





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users