Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

Website Design Forum


You are currently viewing our Website Design Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
[PHP] How to include? Description of include() and require()
Old 02-15-2006, 05:55 PM [PHP] How to include? Description of include() and require()
Junior Talker

Posts: 33
Trades: 0
Instruction include() is serving to read and execute code from file in time when script is running. Also you can use require() instruction, which work same as include(), but they have sundry errors:
  • include() - type of error: Warning, if no file the script will be still running!
    require() - type of error: Fatal Error, if no file the script will be permanently terminated (stopped!)

Basic use of include instruction!
File: data.php
Code:
<?php
$name="Thomas";
$nick="dario";
echo '<span>My name is $name and my nick is $nick</span>';
?>
File: test.php
Code:
<?php
echo '<span>Content of data.php file</span>
';
echo '<span>START</span>

';
include("data.php");
echo '<span>EOS</span>

';
?>
Description: including information from data.php

Include and condition instruction
File: data.php
Code:
<?php
$forum="http://www.myfreedomain.net/";
?>
File: test.php
Code:
<?php
if($including=="yes"){
echo'<span>My favourite </span>';
echo'<a href="';
include("data.php");
echo'">page</a>';
}else{
include("other_file.php");
}
?>
Description: If variable $including will equal with yes then data.php will be included, if no then other_file.php will be included

Basic use of require instruction!
File: data.php
Code:
<?php
$my_login="login";
$my_pass="pass";
?>
File: test.php
Code:
<?php
require("data.php");
if($pass=="$my_pass" && $login=="$my_login"){
echo '<span>You have been loged! :)</span>';
}else{
echo '<span>You taped bad login!</span>';
}
?>
Description: In data.php you have information about login and by the condition instruction you check them!

Created by m1chu
m1chu is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-15-2006, 10:11 PM
Super Talker

Posts: 132
Trades: 0
oh bro i dont know much about php sory i cant help u
__________________
Looking For Mods n Members


Please login or register to view this content. Registration is FREE
waqar is offline
Reply With Quote
View Public Profile
 
Old 02-16-2006, 07:12 AM
Junior Talker

Posts: 161
Trades: 0
Quote:
Originally Posted by Waqar
oh bro i dont know much about php sory i cant help u
:? He wasnt asking for help, he was posting a tutorial.
__________________
West Ham Till i Die!
king-re0-coker is offline
Reply With Quote
View Public Profile
 
Old 02-16-2006, 09:42 AM
Junior Talker

Posts: 33
Trades: 0
Quote:
Originally Posted by king-re0-coker
Quote:
Originally Posted by Waqar
oh bro i dont know much about php sory i cant help u
:? He wasnt asking for help, he was posting a tutorial.
Exactly :] Im sorry if my english is not completly clearly...
m1chu is offline
Reply With Quote
View Public Profile
 
Old 02-16-2006, 09:06 PM
Super Talker

Posts: 132
Trades: 0
i m very soory bro as i ask u i dont know much about php soory i think u asking for help soory
__________________
Looking For Mods n Members


Please login or register to view this content. Registration is FREE
waqar is offline
Reply With Quote
View Public Profile
 
Old 02-17-2006, 05:05 AM
Junior Talker

Posts: 211
Trades: 0
i know some stuff about php. any of you heard of cutenews?
Quahog Crazy is offline
Reply With Quote
View Public Profile
 
Old 02-17-2006, 04:44 PM
Junior Talker

Posts: 295
Trades: 0
Nice...I use the require() to include my header & footer in other pages
__________________

Please login or register to view this content. Registration is FREE
playmenow is offline
Reply With Quote
View Public Profile Visit playmenow's homepage!
 
Reply     « Reply to [PHP] How to include? Description of include() and require()
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.18851 seconds with 12 queries