分享

写回答

发帖

[提问] 无法链接数据库

暮木娃娃

发表于 2013-4-26 09:38:02 | 显示全部楼层

zycrusher 发表于 2013-4-26 09:16 AM
我给你遇到的问题一样,很郁闷,我的程序一模一样的,传国内十几个网站,安装没问题,到godaddy这里都链接 ...

Godaddy的数据库地址不是localhost
需要你先建好数据库,然后去数据库查看下数据库地址。然后修改你网站程序的配置文件
回复 支持 反对

使用道具 举报

GoDaddy GoDaddy 2497 人阅读 | 11 人回复

回答|共 11 个

发表于 2012-8-7 18:43:37 | 显示全部楼层 |阅读模式

LINUX  PHP   MY SQL
上传好网页文件和数据库后
网站经常出现

无法链接数据库,请检查数据库链接配置文件!
错误代码:# - 无法选择数据库,请检查数据库名称是否正确!
错误代码:# -
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/content/28/9577928/html/inc/fun/mysql.php on line 39
SQL语句出错:select * from product_parameter where 1 order by FieldType asc, PId asc
错误代码:# -

一会好 一会出错
不知道为什么

好好学习

发表于 2012-8-7 19:02:17 | 显示全部楼层

联系官方客服帮忙检查下。
将此错误提示,提供给官方!
回复 支持 反对

使用道具 举报

拉风的兔子

发表于 2012-8-7 19:03:38 | 显示全部楼层

英文?
回复 支持 反对

使用道具 举报

暮木娃娃

发表于 2012-8-8 09:07:29 | 显示全部楼层

数据库连接配置文件里代码出错了?
RAKSmart
回复 支持 反对

使用道具 举报

拉风的兔子

发表于 2012-8-8 10:36:27 | 显示全部楼层

问题是  网站一会好 一会出错
要是代码出问题了 不是应该一直没用吗?
回复 支持 反对

使用道具 举报

暮木娃娃

发表于 2012-8-8 10:43:50 | 显示全部楼层

拉风的兔子 发表于 2012-8-8 10:36 AM
问题是  网站一会好 一会出错
要是代码出问题了 不是应该一直没用吗?

那你联系Godaddy客服吧
回复 支持 反对

使用道具 举报

拉风的兔子

发表于 2012-8-8 10:47:31 | 显示全部楼层

Dear Lundeng,

Thank you for contacting Online Support.

From the information that you have provided, it appears that there is an error message on line 36 of the /inc/fun/mysql.php file. As such, you would want to ensure that the proper settings are in place to allow proper connections to your MySQL database. Please ensure you are using the proper connection strings to connect to your database. To view your connection strings for your database, please use the following information:

Log in to your Account Manager.
If you need the login information for your account, please use the Account Retrieval System.


From the Products tab, click Web Hosting.

Click on the Launch button next to the hosting plan in question. The Hosting Control Center opens.

Click the button for the type of database you are working with within the Databases section.

Click on the Edit/View Details icon (the pencil icon) for the database in question.

Click the Configuration button.


If you continue to receive issues and you believe that there is an issue with the server, please respond with detailed instructions on how we can duplicate the issue. Also, please provide us with any URLs of where the error message can be reviewed. We appreciate your understanding on this matter.

Please let us know if we can assist you in any other way.

Sincerely,

Dan P.
Online Support Technician
回复 支持 反对

使用道具 举报

暮木娃娃

发表于 2012-8-8 10:49:59 | 显示全部楼层

拉风的兔子 发表于 2012-8-8 10:47 AM
Dear Lundeng,

Thank you for contacting Online Support.

根据客服说的操作呗
检查下你建的数据库
回复 支持 反对

使用道具 举报

拉风的兔子

发表于 2012-8-8 11:18:34 | 显示全部楼层

暮木娃娃 发表于 2012-8-8 10:49 AM
根据客服说的操作呗
检查下你建的数据库

他给出的参考是

<?php
//Connect To Database
$hostname='xxx';
$username='xxxx';
$password='your password';
$dbname='xxxx';
$usertable='your_tablename';
$yourfield = 'your_field';

mysql_connect($hostname,$username, $password) OR DIE ('Unable to connect to database! Please try again later.');
mysql_select_db($dbname);

$query = 'SELECT * FROM ' . $usertable;
$result = mysql_query($query);
if($result) {
    while($row = mysql_fetch_array($result)){
        $name = $row[$yourfield];
        echo 'Name: ' . $name;
    }
}
?>

我设置的是
//********************************************************数据库相关配置(开始)*********************************************************************
$db_host                =        'xxx';        //数据库地址
$db_port                =        '';                                //数据库端口
$db_username        =        'xxxx';                //数据库用户名
$db_database        =        'xxxx';        //数据库名称
$db_password        =        'your password';                //数据库密码
$db_char                =        'utf8';                        //数据库编码
//********************************************************数据库相关配置(结束)************************************
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则