首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

mysql_fetch_row(): supplied argument is not a valid MySQL result resource,何人能解?该

2012-02-27 
mysql_fetch_row(): supplied argument is not a valid MySQL result resource,何人能解?代码如下:?php/*

mysql_fetch_row(): supplied argument is not a valid MySQL result resource,何人能解?
代码如下:

<?php
/*
 * Created on 2012-1-1
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
 $conn = mysql_connect("localhost","root","") or die ("连接出错");
 mysql_select_db("dongxinb",$conn);

 $sql="SELECT * FROM 'word'";
 $query=mysql_query($sql,$conn);
 $row=mysql_fetch_array($query);
 echo $row[name];
?>

其中name为dongxinb数据库word表的字段。
错误信息:Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in D:\wamp\www\word\1.php on line 13

其中INSERT能正常插入。




[解决办法]
SQL 错了

修改成
$sql="SELECT * FROM word";
[解决办法]

PHP code
<?php/* * Created on 2012-1-1 To change the template for this generated file go to * Window - Preferences - PHPeclipse - PHP - Code Templates */include ("conn.php");?><table width=500 border="0" align="center" cellpadding="5"    cellspacing="1" bgcolor="#add3ef"><?php$sql = "select * from word";$query = mysql_query ( $sql );while ( $row = mysql_fetch_array ( $query ) ) {    echo <<<html  <tr bgcolor="#eff3ff">  <td>姓名:{$row['name']}</td>  </tr>  <tr bgColor="#ffffff">  <td>Message:{$row['words']}</td>  <td>更新时间:{$row['date']}</td>  </tr>html;}?></table> 

热点排行