shirvo Posted February 18, 2007 Share Posted February 18, 2007 i have i config.ph page that l use so i can put all the database login information and the title of the website so it can be changed very simply. Now i have a dbconnect.php page that has to connection script in it The below code is config.php <?php /****** Installation ******/ $sitetitle = 'AusFamily.com' ; // Website title /****** Database ******/ $cfgServerHost = 'localhost'; // MySQL hostname $cfgServerUser = 'shirvo'; // MySQL user $cfgServerPassword = '137879'; // MySQL password $cfgDbDatabase = 'shirvo_ausfamily'; // MySQL database name containing phpSecurePages table $cfgDbTable = 'user'; // Where all the information is stored ?> The below code is dbconnect.php <? include('config.php') $conn = mysql_connect($cfgServerHost, $cfgServerUser, $cfgServerPassword); if (!$conn) die('Error connecting to server!'); mysql_select_db($cfgDbDatabase , $conn) or die('Error selecting database'); ?> Ok now when l use me website is comes up with this; Parse error: syntax error, unexpected T_VARIABLE in /home/shirvo/public_html/dbconnect.php on line 6 line 6 is this; $conn = mysql_connect($cfgServerHost, $cfgServerUser, $cfgServerPassword); so i am thinking that the $cfgServerHost, $cfgServerUser, $cfgServerPassword are not getting through Anyone please help ASAP Link to comment https://forums.phpfreaks.com/topic/38979-include-help/ Share on other sites More sharing options...
phat_hip_prog Posted February 18, 2007 Share Posted February 18, 2007 It all looks ok, I was considering whether you needed to declare the vars as global before you used them, but there not in functions. So, i'm thinking that your password needs to be considered as a string not a number ??? Link to comment https://forums.phpfreaks.com/topic/38979-include-help/#findComment-187661 Share on other sites More sharing options...
Imtehbegginer Posted February 18, 2007 Share Posted February 18, 2007 Try switching all of the $cfg to $cfg['NAMEHERE'] Link to comment https://forums.phpfreaks.com/topic/38979-include-help/#findComment-187665 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.