Current location: Hot Scripts Forums » Programming Languages » PHP » mySQL connection??


mySQL connection??

Reply
  #1 (permalink)  
Old 11-07-03, 06:22 PM
awais awais is offline
Newbie Coder
 
Join Date: Jul 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
mySQL connection??

Hi!
It is possible in PHP to use mySQL database from another hosting account. Let me explain...
My script in abc.com and I want to use database from xyz.com.
is this possible? and how
Reply With Quote
  #2 (permalink)  
Old 11-07-03, 07:54 PM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Not sure if its possible or not, but I doubt that it would be very efficient, or smart. I imagine your bandwidth would be much higher, having "A" (the database) sending data to "B" (your server) to "C" (the viewer). Theres an increase in potential connection problems. Are both web spaces your own accounts that you alone have control over, or can someone else pull the plug on your DB after its all set up? I would think you're much better off keeping it all on one server.
Reply With Quote
  #3 (permalink)  
Old 11-08-03, 03:04 AM
Stefan's Avatar
Stefan Stefan is offline
Junior Code Guru
 
Join Date: Jun 2003
Location: Utrecht, The Netherlands
Posts: 599
Thanks: 0
Thanked 0 Times in 0 Posts
the quick answer: yes, it is possible. using

PHP Code:

mysql_connect("xyz.com""user""password"); 

I have to support mdhall's remark though. your bandwidth will be used much more since instead of just having the user request a page, and that page being sent to the user, you'd have the user requesting your page, the page requesting data from the database, the data from the database being sent back to the server and then the page being sent back to the user.

also, if the database stores any sensitive information, it'd be a lot less secure since all that information will travel over the Internet when php is talking to the database.

but... it is possible
Reply With Quote
  #4 (permalink)  
Old 11-20-03, 11:40 AM
mqcarpenter mqcarpenter is offline
Newbie Coder
 
Join Date: Nov 2003
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Could you do it this way:

$isearch_sql_server = "www.mydomain.com";
$isearch_sql_username = "user_name";
$isearch_sql_password = "password";
$isearch_sql_database = "database_name";

For the server, can I just put in the web address? Like, "www.mydomain.com" and put the DB name, user, etc?

TIA
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 02:22 AM
great product for dumping/recovering MySQL databases Dave Brown General Advertisements 1 10-03-03 07:40 AM
mysql to access aspuser25 Database 2 09-16-03 11:01 AM
mysql v2UK ASP 2 08-18-03 08:50 PM
Closing a MySQL connection surebetdmg PHP 5 08-15-03 08:37 AM


All times are GMT -5. The time now is 05:40 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.