access remote database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shankari
Forum Newbie
Posts: 9
Joined: Mon Oct 03, 2011 9:37 am

access remote database

Post by shankari »

Hi,

I have hosted my website. I had only html files. But now I want to create a form in php. But I cannot access database as per the plan that I bought.
Instead I have a friend who says I can use access her database and she has given all the permissions.

This php file is in server A and the database test_db is in server B.
<?php



$user_name = "aaaa";
$password = "bbbbb";
$database = "test_db";
$server = "xxxxxxxxx";
$db_handle = mysql_connect($server, $user_name, $password);
$db_found = mysql_select_db($database, $db_handle);
?>
When I try to run this php file, I get this error



Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@sds.xxx.in and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


--------------------------------------------------------------------------------

Apache mod_fcgid/2.3.6 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 Server at sds.xxx.in Port 80


Pl help me.


Shankari
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: access remote database

Post by Christopher »

That is a HTTP error message. Are you adding http:// to the server name? It should just me the domain name or IP address.
(#10850)
shankari
Forum Newbie
Posts: 9
Joined: Mon Oct 03, 2011 9:37 am

Re: access remote database

Post by shankari »

This is the URL,


domainname.in/test.php
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: access remote database

Post by Christopher »

It should just be domainname.in or the IP address. You connect to the MySQL server on port 3306, not via the web server.
(#10850)
Post Reply