princesohrab Posted June 16, 2013 Share Posted June 16, 2013 hi all, wondering if you would be able to help me..im trying to connect to my database but i keep getting the error message which i echo in the page <?php DEFINE('DB_USER', 'ok');DEFINE('DB_PASSWORD', 'ok');DEFINE('DB_HOST', 'ok.com.mysql');DEFINE('DB_NAME', 'o_co');$dbconnect = mysql_connect(DB_USER, DB_PASSWORD, DB_HOST, DB_NAME);if (!$dbconnect) {die('Error connecting to the database');} echo 'You have connected successfully';?> Link to comment Share on other sites More sharing options...
paulonline2501 Posted June 16, 2013 Share Posted June 16, 2013 (edited) You can display connection error like so:. mysql_error() Append it to you current error message Edited June 16, 2013 by as_bold_as_love 1 Link to comment Share on other sites More sharing options...
princesohrab Posted June 16, 2013 Author Share Posted June 16, 2013 Hey sorry guys.. Ive done itthanks Link to comment Share on other sites More sharing options...
princesohrab Posted June 16, 2013 Author Share Posted June 16, 2013 I just had to put the define host first Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now