kv79 Posted March 25, 2008 Share Posted March 25, 2008 HI all,How can I connect to database mySQL $con = mysql_connect("localhost","dani","dani"); I want to connect to my friend host over internet . Thanks in advance . Link to comment Share on other sites More sharing options...
justsomeguy Posted March 25, 2008 Share Posted March 25, 2008 mysql_connect is the correct function to use. Check the reference page for mysql_connect if you have questions about it.http://www.php.net/manual/en/function.mysql-connect.php Link to comment Share on other sites More sharing options...
zeeshan Posted March 25, 2008 Share Posted March 25, 2008 see you might have been confused in the place of local host what you should put? leave it as it is.and type your password and username Link to comment Share on other sites More sharing options...
kv79 Posted March 25, 2008 Author Share Posted March 25, 2008 Thank you . Link to comment Share on other sites More sharing options...
kv79 Posted March 28, 2008 Author Share Posted March 28, 2008 But i want to connect to my database over the internet and I do not know how ? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 28, 2008 Share Posted March 28, 2008 $con = mysql_connect("the-address-of-the-server-with-your-database-on-it.com","dani","dani"); Link to comment Share on other sites More sharing options...
kv79 Posted March 28, 2008 Author Share Posted March 28, 2008 do you have any example? Link to comment Share on other sites More sharing options...
justsomeguy Posted March 28, 2008 Share Posted March 28, 2008 I don't know what you're missing. There are now 2 examples of mysql_connect in this thread, one posted by you, and a link to the mysql_connect reference page that has more examples on it and more links to other pages with even more examples. Link to comment Share on other sites More sharing options...
kv79 Posted March 28, 2008 Author Share Posted March 28, 2008 Look ,if you did not do that before that is fine . I am aware that you want to help me but you are not helping me . Link to comment Share on other sites More sharing options...
Synook Posted March 28, 2008 Share Posted March 28, 2008 But JSG posted exactly what you should use. What more can you want? $con = mysql_connect("the-address-of-the-server-with-your-database-on-it.com","dani","dani"); Link to comment Share on other sites More sharing options...
kv79 Posted March 28, 2008 Author Share Posted March 28, 2008 I said that i want to connect to my friend database and my friend have no domain .Synook -> That what he wrote mean that I must have .com domain . If i typed an public address of server like this "80.242.118.7:3306" will not let me go in database . You should try .And i can connect only if i typed like this "localhost" or "localhost:3306"Thank you for your effort of trying to help me . Link to comment Share on other sites More sharing options...
kv79 Posted March 28, 2008 Author Share Posted March 28, 2008 Hi , I solved my problem , I did not add a privileges to my new user .And my friend who is expert , told me . Link to comment Share on other sites More sharing options...
justsomeguy Posted March 30, 2008 Share Posted March 30, 2008 I said that i want to connect to my friend database and my friend have no domain .No you did not say that, you never mentioned no domain. Scroll up and look. If you don't have a domain then you access by IP address."80.242.118.7:3306" will not let me go in database .You don't include the port with the IP. The mysql_connect function automatically connects on port 3306, you don't need to tell it to. Just use 80.242.118.7.If you want help from people you need to give them the information they need to help you. No one here could have guessed that you were trying to connect to a server by IP and using the port number on the end. When you ask a question, post the code you're using that is wrong so we can see what you're trying to do. You should have posted what you posted above first. Link to comment Share on other sites More sharing options...
kv79 Posted March 31, 2008 Author Share Posted March 31, 2008 OK,thanks anyway for Helping me , I was wrong and you are right . Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.