dqtok88424 2012-12-18 08:13
浏览 81
已采纳

发送数据到另一个数据库服务器

I've a website connected with database. When I fill the form the php script send the data to the database. The website and the database are on same server. To store the data in database I use:

    $con=mysql_connect('localhost',$id,$password);
    mysql_select_db($dabase,$con);
    $query=mysql_query($queryToRun);

This is how I send data to the database. Now I want to store the same form on a database stored on another server. Is it possible, if yes then how? Any kind of help is appreciated very much.

  • 写回答

3条回答 默认 最新

  • doter1995 2012-12-18 08:17
    关注

    The remote database needs to be configured to allow remote connections. See this question.

    Once that is set up, you just need to set the server IP/hostname in the mysql_connect() call instead of localhost.

    Side note: The mysql_* API is deprecated, it is recommended to upgrade to MySQLi or PDO.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog