Reply
Including a config.php file
Old 11-15-2007, 06:39 PM Including a config.php file
Experienced Talker

Posts: 33
Name: matt
I have a file called config.php with the contents of:
PHP Code:
$dbloc="localhost";
$dbname="*****_wiki";
$dbuser="*****_wiki";
$dbpass="wiki";
$dbprefix="wiki_";
$sitename="test";
$sitepass="test";
$siturl="test";
# END CONFIG # 
and then i put this in another php file
PHP Code:
include 'include/installconfig.php'
and it prints the contents of the file, it is supposed to just use those variables in the script im including it in. thanks
melefire is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 11-15-2007, 06:42 PM Re: Including a config.php file
chrishirst's Avatar
Super Moderator

Posts: 12,645
Location: Blackpool. UK
do you have php script delimiters around the code in the include ?
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-15-2007, 06:45 PM Re: Including a config.php file
Experienced Talker

Posts: 33
Name: matt
no, if you mean <?php and ?>
melefire is offline
Reply With Quote
View Public Profile
 
Old 11-15-2007, 07:07 PM Re: Including a config.php file
chrishirst's Avatar
Super Moderator

Posts: 12,645
Location: Blackpool. UK
I do ..
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 11-15-2007, 07:49 PM Re: Including a config.php file
King Spam Talker

Posts: 1,062
And unless I mis-read what you wrote it would be:

Quote:
<?php include ("/config.php"); ?>
and the / might not be required.
colbyt is offline
Reply With Quote
View Public Profile
 
Old 11-15-2007, 08:06 PM Re: Including a config.php file
Experienced Talker

Posts: 33
Name: matt
thanks
melefire is offline
Reply With Quote
View Public Profile
 
Old 11-16-2007, 12:15 PM Re: Including a config.php file
rogem002's Avatar
Webmaster Talker

Posts: 569
Name: Mike
Location: United Kingdom
Change the code to:

PHP Code:
<?php
$dbloc
="localhost";
$dbname="*****_wiki";
$dbuser="*****_wiki";
$dbpass="wiki";
$dbprefix="wiki_";
$sitename="test";
$sitepass="test";
$siturl="test";
# END CONFIG #
?>
PHP Code:
<?php
include 'include/installconfig.php';
?>
I best also point out, it's a good idea to * out the password as well hehe.
__________________
Website Services
PHP Code:
if(Added_Talkupation($post) == TRUE){iHug($you);} 

Last edited by rogem002 : 11-16-2007 at 12:22 PM.
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 11-16-2007, 06:17 PM Re: Including a config.php file
Average Talker

Posts: 23
i also add those on my projects... it makes your project easy to update and manage
mountlaurel is offline
Reply With Quote
View Public Profile Visit mountlaurel's homepage!
 
Reply     « Reply to Including a config.php file
 

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

vB 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.14240 seconds with 13 queries