PHP Includes

This is a discussion on "PHP Includes" within the PHP Forum section. This forum, and the thread "PHP Includes are both part of the Program Your Website category.



 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1  
Old May 31st, 2006, 15:34
Up'n'Coming Member
Join Date: Apr 2006
Location: Missouri
Age: 32
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
PHP Includes

I am used to the nice easy include statements of ASP, why can I not just include files like this?

Code: Select all
<?php require_once('/db/DB.php'); ?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old May 31st, 2006, 15:43
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Includes

Yayhooray!
Code: Select all
<?php require("file.html"); ?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old May 31st, 2006, 16:07
Up'n'Coming Member
Join Date: Nov 2005
Location: England
Posts: 71
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Includes

What you have written is fine in terms of syntax. Its probably a case of not being able to find the file. As a general rule, if the file isnt in the same directory use:

<?php require_once($_SERVER['document_root'].'/db/DB.php'); ?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old May 31st, 2006, 20:54
Reputable Member
Join Date: Sep 2005
Location: Canada, BC
Age: 24
Posts: 239
Thanks: 0
Thanked 0 Times in 0 Posts
Re: PHP Includes

Quote:
Originally Posted by lesleindotcom
I am used to the nice easy include statements of ASP, why can I not just include files like this?

Code: Select all
<?php require_once('/db/DB.php'); ?>
You can include files like that, however, the file you are calling might not exist in that location as said above, what is the exact error you are reciveing?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
php, includes

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
xsl includes sconard Other Programming Languages 0 Aug 24th, 2006 13:11
PHP Includes daygon PHP Forum 5 Mar 16th, 2006 01:59
CSS and includes rewmer Web Page Design 4 Aug 14th, 2005 10:31
Further Help with Includes freebirdnz Classic ASP 3 Aug 5th, 2004 13:48
Help with includes. freebirdnz Classic ASP 5 Aug 3rd, 2004 14:38


All times are GMT. The time now is 17:23.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42