Go4Expert

Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   Need help connecting PHP and mySQL (http://www.go4expert.com/forums/help-connecting-php-mysql-t28688/)

The Alchemist 8Jul2012 13:45

Need help connecting PHP and mySQL
 
Hello everyone..
I'm trying to connect to my mySQL database named mydb using PHP.
The hosting site where I've created my database says : Server: "Localhost via UNIX socket"
So, if I connect with mysql_connect($hostname,$user,$password);
What will be the value of $hostname? will it be $hostname='localhost:9000' or 'localhost' or what should I put?

shabbir 8Jul2012 13:58

Re: Need help connecting PHP and mySQL
 
The host should be your host's IP address or hostname. It can be localhost if your PHP and MySQL are on the same server of your host.

The Alchemist 8Jul2012 18:28

Re: Need help connecting PHP and mySQL
 
I think its localhost... Thanks for helping.

hanleyhansen 31Jul2012 01:32

Re: Need help connecting PHP and mySQL
 
I recommend using PHP's PDO or mysqli instead of mysql_connect as mysql_connect won't be supported for long and the community has already begun the deprecation process.

The Alchemist 16Aug2012 11:35

Re: Need help connecting PHP and mySQL
 
Thanks for the suggestion guys... I realised that its normally given on the hosting sites... Anyways, thanks for helping...


All times are GMT +5.5. The time now is 01:31.