bugzy Posted March 31, 2012 Share Posted March 31, 2012 Hello! I have this db_connection.php <?php $_SESSION['MYSQL_SERVER1'] = "localhost"; $_SESSION['MYSQL_LOGIN1'] = "root"; $_SESSION['MYSQL_PASS1'] = "password"; $_SESSION['MYSQL_DB1'] = "user_registration"; $_SESSION['LOGGEDIN'] = ""; $_SESSION['USERID'] = 0; $_SESSION['EMAIL'] = ""; $_SESSION['FNAME'] = ""; $_SESSION['LNAME'] = ""; $_SESSION['SESSION'] = true; ?> and I'm calling it using this code mysql_connect($_SESSION['MYSQL_SERVER1'],$_SESSION['MYSQL_LOGIN1'],$_SESSION['MYSQL_PASS1']) or die("Unable to connect to SQL server"); mysql_select_db($_SESSION['MYSQL_DB1']) or die("Unable to select database"); and it's giving me error Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'user1'@'localhost' (using password: YES) in C:\wamp\www\php\user_registration\registered.php on line 84 Unable to connect to SQL server why is it it's pointing to user1'@'localhost ?? because I'm using the above connection and it should be "root" right? I have double check everything and tried to use the above connection using different code and it works. I wonder why it isn't working on the 2nd code that I posted... btw I'm using mysql from wamp server that is installed on my pc Link to comment Share on other sites More sharing options...
trq Posted March 31, 2012 Share Posted March 31, 2012 Have you called session_start before using the $_SESSION array? Again however as I said in another of your threads, you should not be using the $_SESSION array to store these settings. They are application specific, not user specific. Link to comment Share on other sites More sharing options...
bugzy Posted March 31, 2012 Author Share Posted March 31, 2012 Hey thorpe thanks! I finally solve it! thanks again! Link to comment Share on other sites More sharing options...
Ravi3352 Posted June 17, 2013 Share Posted June 17, 2013 (edited) @bugzy cud u xplain ...how did u fix it .. i m stuk wid the same problem .. Edited June 17, 2013 by Ravi3352 Link to comment Share on other sites More sharing options...
trq Posted June 17, 2013 Share Posted June 17, 2013 Instead of dredging up some old thread from over 12 months ago why don't you post your own topic describing your problem. How do you know it is even the same issue? Link to comment Share on other sites More sharing options...
Recommended Posts