karimali831 Posted February 28, 2010 Share Posted February 28, 2010 Hi, Can someone tell me how I can fix this please. I get can not connect to SQL server. I'm using pagination -> http://www.phpfreaks.com/tutorial/basic-pagination and works fine when I manually input the database information. E.g: // database connection info $conn = mysql_connect('localhost','user','password') or trigger_error("SQL", E_USER_ERROR); $db = mysql_select_db('database',$conn) or trigger_error("SQL", E_USER_ERROR); -> is fine. But I need to use it like this: // database connection info include("_mysql.php"); $conn = mysql_connect($host, $user, $pwd) or system_error('ERROR: Can not connect to MySQL-Server'); $db = mysql_select_db($db, $conn) or trigger_error("SQL", E_USER_ERROR); and the _mysql.php file is like: <?php $host = "localhost"; $user = "user"; $pwd = "password"; $db = "database"; define("PREFIX", 'ficocup_'); ?> I'm sure that's correct. Anyone help me please? Thank you Quote Link to comment Share on other sites More sharing options...
MadTechie Posted February 28, 2010 Share Posted February 28, 2010 looks fine, test it by echo'ing the variables, (is the include pointing to the correct path ?) Quote Link to comment Share on other sites More sharing options...
karimali831 Posted February 28, 2010 Author Share Posted February 28, 2010 For some reason it works now. Perhaps cache, thanks anyway. 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.