prakash911 Posted March 16, 2010 Share Posted March 16, 2010 guys if i use the mysql_connect command from php to connect to a mysql server, but information do i need to provide if i want to connect to this particular server and bookstore database in that server here is an image i need the information from: Quote Link to comment Share on other sites More sharing options...
StathisG Posted March 16, 2010 Share Posted March 16, 2010 Read this Example: mysql_connect('localhost','root','password'); mysql_select_db('bookstore'); Also you need to handle errors. Quote Link to comment Share on other sites More sharing options...
prakash911 Posted March 16, 2010 Author Share Posted March 16, 2010 would i need to make host:localhost:3306 or is localhost fine Quote Link to comment Share on other sites More sharing options...
LeadingWebDev Posted March 16, 2010 Share Posted March 16, 2010 localhost default port specified in php.ini Quote Link to comment Share on other sites More sharing options...
satre Posted March 16, 2010 Share Posted March 16, 2010 Here's ways to handle the errors: $sql0 = mysql_connect('localhost','root','password'); if (!$sql0) { die('Could not connect: ' . mysql_error()); } if (!mysql_select_db('bookstore')) { die('Could no select database: ' . mysql_error()); } 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.