blink359 Posted May 4, 2009 Share Posted May 4, 2009 I wanted to store my database info in another file lets say config.php so i put my db info in like so <?php $dbhost = "localhost"; //database host goes here $dbuser = "your_user"; //database user goes here $dbpass = "your_password"; //database password goes here $dbname = "logon"; //database name goes here ?> and in the page i want to include it i put include("config.php"); But when i went on the page i used the include it had just echoed my database info on the page what have i done wrong Link to comment https://forums.phpfreaks.com/topic/156760-solved-storing-database-info-in-another-file/ Share on other sites More sharing options...
gevans Posted May 4, 2009 Share Posted May 4, 2009 Are you sure the page you're including uses a .php extension? Link to comment https://forums.phpfreaks.com/topic/156760-solved-storing-database-info-in-another-file/#findComment-825489 Share on other sites More sharing options...
blink359 Posted May 4, 2009 Author Share Posted May 4, 2009 Im sure hang on ill just try it all again see if it was a one off or something Link to comment https://forums.phpfreaks.com/topic/156760-solved-storing-database-info-in-another-file/#findComment-825492 Share on other sites More sharing options...
Potatis Posted May 4, 2009 Share Posted May 4, 2009 Use define: <?php define("DB_SERVER", "localhost"); define("DB_USER", "root"); define("DB_PASS", ""); define("DB_NAME", "dbname"); ?> Link to comment https://forums.phpfreaks.com/topic/156760-solved-storing-database-info-in-another-file/#findComment-825493 Share on other sites More sharing options...
blink359 Posted May 4, 2009 Author Share Posted May 4, 2009 kk thanks Link to comment https://forums.phpfreaks.com/topic/156760-solved-storing-database-info-in-another-file/#findComment-825494 Share on other sites More sharing options...
gevans Posted May 4, 2009 Share Posted May 4, 2009 Although using define in this situation isn't a bad idea it shouldn't be the solution to the issue Link to comment https://forums.phpfreaks.com/topic/156760-solved-storing-database-info-in-another-file/#findComment-825495 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.