Go Back   Novahq.net Forum > Computers > Web design and Programming
FAQ Community Calendar Today's Posts Search

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-30-2005, 06:15 PM
DevilDog#1 is offline DevilDog#1

Join Date: Jul 2002
Posts: 7,040

PHP N00by question

What's the difference b/w

PHP Code:
include('templates/header1.html'); 
and

PHP Code:
require('templates/header1.html'); 
Only relevant replies please ...
__________________








Quote:
If I don't do that doesn't mean I can't - DD#1
Reply With Quote
  #2  
Old 12-30-2005, 06:55 PM
Lakie is offline Lakie

Join Date: Mar 2002
Posts: 5,540

the main difference is that upon an error (ie. the specified file isnt there) a require will give a fatal error and the script will stop there, a include will give a warning and continue with the script...
Reply With Quote
  #3  
Old 12-30-2005, 06:58 PM
DevilDog#1 is offline DevilDog#1

Join Date: Jul 2002
Posts: 7,040

uh huh ... include be good, huh?
__________________








Quote:
If I don't do that doesn't mean I can't - DD#1
Reply With Quote
  #4  
Old 12-30-2005, 07:03 PM
JonM is offline JonM
Registered User

Join Date: Jun 2004
Posts: 2,156

You use require when requiring files that are for sure needed for the script to work. For instance if you have a file like header.php which connects, sets variables, etc...if it doesn't work you need a fatal error. It could be dangerous to just include it. (i think). Include as mike said just gives a warning and continues on. so include files such as count.php which would count the hits of the site...that's it.
Reply With Quote
  #5  
Old 12-30-2005, 08:17 PM
DevilDog#1 is offline DevilDog#1

Join Date: Jul 2002
Posts: 7,040

header () question

How common is the usage of hardcoding URL using header () ?

Something like

PHP Code:
header ('Location: [url]http://www.novahq.net/admin/banpage.php[/url]'); 

Edit: BTW THanks Elite.
__________________








Quote:
If I don't do that doesn't mean I can't - DD#1
Reply With Quote
  #6  
Old 12-30-2005, 09:19 PM
JonM is offline JonM
Registered User

Join Date: Jun 2004
Posts: 2,156

it is common whenever you want to redirect with out a message on the page your redirecting from. If you want a thanks for posting, you will be transfere in 5 seconds META_REFRESH or whatever works better.

Umm i've never seen
PHP Code:
header('Location: <a href="" target="_blank">link</a>'); 
does that really work? if it does then hot dog lol, cuz i could use that.
Reply With Quote
  #7  
Old 12-30-2005, 09:29 PM
DevilDog#1 is offline DevilDog#1

Join Date: Jul 2002
Posts: 7,040

I haven't tried refresh yet ... but was just wondering if it be used. Let me know if it actually works

Edit:

Following code works for Refreshing in PURE PHP Environment.

PHP Code:
header ('Location: welcomepage.php');
exit(); 
__________________








Quote:
If I don't do that doesn't mean I can't - DD#1

Last edited by DevilDog#1; 12-30-2005 at 09:42 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
php question BlackMass Web design and Programming 7 06-26-2006 09:22 PM
PHP Question? Webviper2006 Web design and Programming 12 02-08-2006 04:37 PM
PHP uploader question BOne Web design and Programming 11 03-18-2005 04:22 PM
PHP question Ice Cannon Web design and Programming 3 07-07-2003 12:14 AM
PHP question Kip Kilagan Web design and Programming 3 03-21-2003 02:39 AM


All times are GMT -5. The time now is 03:30 AM.




Powered by vBulletin®