查询错误 麻烦帮忙改下 : <?php //DataBase Info
$dbhost = "localhost"; // DB Host
$dbuser = "admin"; // DB User
$dbpasswd = "admin"; // DB User Password
$dbname = "mysql"; // DB Name
//DataBase Connect
$mylink=mysql_connect($dbhost,$dbuser,$dbpasswd);
mysql_select_db($dbname,$mylink);
//Select SQL
$sql="select help_topic_id,help_keyword_id from $help_relation";
$result=mysql_query($sql);
while($myarray=mysql_fetch_array($result))
{
//Print result
echo $myarray["help_topic_id"];
echo $myarray["help_keyword_id"];
echo "<br>";
} ?>错误提示:Notice: Undefined variable: user in D:\PC_webserver\phproot\1.php on line 13Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\PC_webserver\phproot\1.php on line 15看出来的帮忙改下 !
$dbhost = "localhost"; // DB Host
$dbuser = "admin"; // DB User
$dbpasswd = "admin"; // DB User Password
$dbname = "mysql"; // DB Name
//DataBase Connect
$mylink=mysql_connect($dbhost,$dbuser,$dbpasswd);
mysql_select_db($dbname,$mylink);
//Select SQL
$sql="select help_topic_id,help_keyword_id from $help_relation";
$result=mysql_query($sql);
while($myarray=mysql_fetch_array($result))
{
//Print result
echo $myarray["help_topic_id"];
echo $myarray["help_keyword_id"];
echo "<br>";
} ?>错误提示:Notice: Undefined variable: user in D:\PC_webserver\phproot\1.php on line 13Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\PC_webserver\phproot\1.php on line 15看出来的帮忙改下 !
mysql_connect($dbhost,$dbuser,$dbpasswd);
mysql_select_db($dbname);
//Select SQL
$sql="select help_topic_id,help_keyword_id from $help_relation";
1: ","改为 ","
2: $help_relation的值有么?这个表存在么
没有连上数据库并且没找到$help_relation
能给我说说 为什么嘛?
$help_relation 是变量,而你没有这个变量啊
help_relation 是字符串,如果有这个表,那当然就可以了
而你的表的名字叫help_relation??
如果要变成 ip 地址 远程的 还应该加什么 例如:58.218.212.84 端口是 212
$port = 端口(端口不同于默认的情况下)
其他的没有了