project3 Posted December 4, 2007 Share Posted December 4, 2007 I have a cpanel db and it is in the form of user_dbname so i have the db login info in a include file. $db = "user_dbname"; when i call $db from main script it removes right after user with no _dbname. if I move $db = "user_dbname"; into the script it works just fine. why is the _dbname being removed? Quote Link to comment Share on other sites More sharing options...
project3 Posted December 4, 2007 Author Share Posted December 4, 2007 I figured out its not pulling the info from the file? but I don't know why thats really odd. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 4, 2007 Share Posted December 4, 2007 Is the path to the include correct? Do you have error reporting on so you can see an error if there is one? Quote Link to comment Share on other sites More sharing options...
project3 Posted December 4, 2007 Author Share Posted December 4, 2007 No errors and I have the file chmod to 666. include file (db.php): <? $du = "project3boon"; ?> main file: <?php require 'inc/db.php'; echo $du; And nothing outputs. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 4, 2007 Share Posted December 4, 2007 Where is inc folder, one below your main? Quote Link to comment Share on other sites More sharing options...
project3 Posted December 4, 2007 Author Share Posted December 4, 2007 yes. like this inc folder inside otherfolder inside that folder is main.php if i rename the inc file i get an error that it cant be found so i know its seeing it. Quote Link to comment Share on other sites More sharing options...
revraz Posted December 4, 2007 Share Posted December 4, 2007 I've always used ( ) around mine, so try require ('inc/db.php'); Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 4, 2007 Share Posted December 4, 2007 Use a full opening php tag <?php in the include file. The code in it is not getting parsed on your server using the short open tag. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.