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? Link to comment https://forums.phpfreaks.com/topic/80167-storing-db-login-info-in-include-file-removes-_-from-db-name/ 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. Link to comment https://forums.phpfreaks.com/topic/80167-storing-db-login-info-in-include-file-removes-_-from-db-name/#findComment-406332 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? Link to comment https://forums.phpfreaks.com/topic/80167-storing-db-login-info-in-include-file-removes-_-from-db-name/#findComment-406336 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. Link to comment https://forums.phpfreaks.com/topic/80167-storing-db-login-info-in-include-file-removes-_-from-db-name/#findComment-406339 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? Link to comment https://forums.phpfreaks.com/topic/80167-storing-db-login-info-in-include-file-removes-_-from-db-name/#findComment-406356 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. Link to comment https://forums.phpfreaks.com/topic/80167-storing-db-login-info-in-include-file-removes-_-from-db-name/#findComment-406360 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'); Link to comment https://forums.phpfreaks.com/topic/80167-storing-db-login-info-in-include-file-removes-_-from-db-name/#findComment-406363 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. Link to comment https://forums.phpfreaks.com/topic/80167-storing-db-login-info-in-include-file-removes-_-from-db-name/#findComment-406365 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.