douliao1911 2012-12-10 04:49
浏览 95

mysql_fetch_array()期望参数1是资源,在[关闭]中给出布尔值

this is the code that I have been using to try and connect to a database and retrieve data from it but it's not showing images properly. All other content is displayed properly.

//This php quote is test2.php
<?php

$dbhost='localhost';
$dbuser='root';
$dbpass='';
$db='dynamic';

$con = mysql_connect("localhost","elemental","");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }



mysql_selectdb($db);

?>


<?php
include 'test2.php';

$query="selelct * from data";
$result=mysql_query($query);

while ($data=mysql_fetch_array($result)) {

echo '<h3>' . $data['id'] . '</h3>';
    echo '<h3>' . $data['name'] . '</h3>';

}


?>
  • 写回答

2条回答 默认 最新

  • doutouman6245 2012-12-10 04:52
    关注

    You have 2 typos:

    $query="selelct * from data";  
    

    should be:

    $query="select * from data";  //select not selelct
    

    and

    mysql_selectdb($db);  
    

    should be:

    mysql_select_db($db);
    
    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集