<?php
mysql_connect("localhost","root","");
mysql_select_db("news");$exec="select * from news";
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result))
{
echo "n_title:".$rs->n_title."<br>";
}?>错误如下:Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in d:\usr\www\html\news\index.php on line 12我的环境是XP,Apache+PHP+MySQL服务器组合套件V1
mysql_connect("localhost","root","");
mysql_select_db("news");$exec="select * from news";
$result=mysql_query($exec);
while($rs=mysql_fetch_object($result))
{
echo "n_title:".$rs->n_title."<br>";
}?>错误如下:Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in d:\usr\www\html\news\index.php on line 12我的环境是XP,Apache+PHP+MySQL服务器组合套件V1
、
说明,你没有MySQL可以被连接主要出错可能是MySQL服务器地址错误
数据库没有选错吧?表名没有打错吧?
$link=mysql_connect("localhost","root","");
mysql_select_db("news");$exec="select * from news";
$result=mysql_query($exec);
while($rs=mysql_fetch_array($result))
{
echo "n_title:".$rs->n_title."<br>";
}?>