警告:mysql_fetch_assoc()期望参数1是资源,给定布尔值 [英] Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given

查看:92
本文介绍了警告:mysql_fetch_assoc()期望参数1是资源,给定布尔值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有错误说

警告:mysql_fetch_assoc()期望参数1是资源,布尔给定





我的尝试:



home.php



<?php 
include(auth.php);

?>



<!DOCTYPE html>
< head>

< title> Tamarga |论坛< /标题>

< link rel =快捷图标href =../ favicon.ico>
< link rel =stylesheettype =text / csshref =css / style.css>
< style>
body
{
background-image:url('img / indexback.jpg');
背景附件:固定;
背景大小:100%100%;
}
< / style>
< / head>
< body>




< ul class =topnav>
< li style =float:right>< a href =logout.phpfloat =right>退出< / a>< / li>
< li style =float:right>< a> Hello<?php echo $ _SESSION ['Username']; ?>!< / A>< /锂>
< li>< a class =activehref =#home> Tamarga论坛< / a>< / li>
< li>< a href =#home>主页< / a>< / li>



< / ul>

< br> <峰; br>
< center>
< div class =btn-group>
< button class =button>发表评论< / button>
< / div>

< / center>




< center>

< br>
< table>
< tr>
< th>类别< / th>
< th>说明< / th>
< / tr>


<?php

包括'dbconnect.php';
$ sql =SELECT cat_name,cat_desc FROM tblcategories;

$ query = mysql_query($ sql);
while($ users = mysql_fetch_assoc($ query)){
echo< tr>;
echo< td>。$ users ['cat_name']。< / td>;
echo< td>。$ users ['cat_desc']。< / td>;
echo< / tr>;

}
?>
< / table>
< / center>
< / div>
< / body>
< / html>

解决方案

_SESSION ['Username']; ?>!< / A>< /锂>
< li>< a class =activehref =#home> Tamarga论坛< / a>< / li>
< li>< a href =#home>主页< / a>< / li>



< / ul>

< br> <峰; br>
< center>
< div class =btn-group>
< button class =button>发表评论< / button>
< / div>

< / center>




< center>

< br>
< table>
< tr>
< th>类别< / th>
< th>说明< / th>
< / tr>


<?php

包括'dbconnect.php';


sql =SELECT cat_name,cat_desc FROM tblcategories;

查询=的mysql_query(

I have an errors it says

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given



What I have tried:

home.php

 <?php 
include("auth.php");

 ?>



<!DOCTYPE html>
<head>
     
        <title>Tamarga | Forum</title>
  
        <link rel="shortcut icon" href="../favicon.ico"> 
       <link rel="stylesheet" type="text/css" href="css/style.css">
       <style>
			body
				{
					background-image: url('img/indexback.jpg');
					background-attachment: fixed;
					background-size: 100% 100%;
				}
		</style>
    </head>
    <body>



	
<ul class="topnav">
 <li style="float:right"><a href="logout.php" float="right">Logout</a></li>
    <li style="float:right"><a>Hello <?php echo $_SESSION['Username']; ?>!</a></li>
    <li><a class="active" href="#home">Tamarga Forum</a></li>
    <li><a href="#home">Home</a></li>



</ul>

  <br> <br>
<center>
<div class="btn-group">
  <button class="button">Post Your Comments</button>
  </div>

</center>




<center>

<br>
<table>
<tr>
    <th>Category</th>
    <th>Description</th>
    </tr>


<?php

include 'dbconnect.php';
$sql="SELECT cat_name,cat_desc FROM tblcategories";

$query=mysql_query($sql);
while ($users=mysql_fetch_assoc($query)){
    echo "<tr>";
    echo "<td>".$users['cat_name']."</td>";
    echo "<td>".$users['cat_desc']."</td>";
    echo "</tr>";

}
?>
</table>
   </center> 
     </div>
    </body>
</html>

解决方案

_SESSION['Username']; ?>!</a></li> <li><a class="active" href="#home">Tamarga Forum</a></li> <li><a href="#home">Home</a></li> </ul> <br> <br> <center> <div class="btn-group"> <button class="button">Post Your Comments</button> </div> </center> <center> <br> <table> <tr> <th>Category</th> <th>Description</th> </tr> <?php include 'dbconnect.php';


sql="SELECT cat_name,cat_desc FROM tblcategories";


query=mysql_query(


这篇关于警告:mysql_fetch_assoc()期望参数1是资源,给定布尔值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆