I am a webmaster for a friend and I'm trying to write a Php script that allows me to connect to a database and input data from a form. The Database does exist on his server (the same server I use for my own website, and mine works fine). When I log into his web server using PuTTy (a secure telnet program) a I can access the database with no problem from the command line. But, when I try to do it from a form via my browser, I am unable to even connect to the database server on his site.
Here's the code:
$dbcnx = @mysql_connect ("localhost", "username", "password");
if (!$dbcnx) {
echo("<p>Unable to connect to the database server at this time.</p>" );
exit();
}
I wrote the error IF statement to let me know if I'm not connecting to the server. Note, the username and password in the real code are the same ones I use to allow me to log in from the command line. I use this same setup to connect to the server on my own website (same ISP) and it works fine. Any idea why I;m having trouble? (I get the "Unable to connect..." message
Thanks,
Basil