donglv6747 2016-07-31 08:52
浏览 99

php请求:警告:mysql_connect():php_network_getaddresses:getaddrinfo失败:没有这样的主机已知

PHP requests show a message Warning:

mysql_connect(): php_network_getaddresses: getaddrinfo failed: No such host is known. in D:\xampp\htdocs\project\www\js\insert.php on line 12

I am using openshift host and ionic framework. I'm still working on localhost.

Here is insert.php :

<?php
$data = json_decode(file_get_contents("php://input"));
$first_name = mysql_real_escape_string($data->first_name);
$last_name = mysql_real_escape_string($data->last_name);
$age = mysql_real_escape_string($data->age);
$homeCity = mysql_real_escape_string($data->homeCity);
$mobile = mysql_real_escape_string($data->mobile);


$host="www.pyf-michaelreda96.rhcloud.com";

mysql_connect($host,"********","********") or die(mysql_error());
mysql_select_db("database") or die(mysql_error());
mysql_query("INSERT INTO members(first_name,last_name,age,home_city,mobile_number)VALUES('".$first_name."','".$last_name."','".$age."','".$homeCity."','".$mobile."')");
$id = json_decode(mysql_insert_id());
echo $id;
?>
  • 写回答

1条回答 默认 最新

  • dongpanshi2839 2016-07-31 15:42
    关注

    The MySQL server on your OpenShift gear is not accessible from the internet, it is only accessible from the gear, or over port forwarding. You can learn more about accessing your database over port forwarding here: https://developers.openshift.com/managing-your-applications/port-forwarding.html

    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数