查询正在运行但未显示任何内容
问题描述:
我的程序中有以下代码。我不添加数据库连接和$ cat_id这些都很好。查询正在运行但未显示任何内容
<?php
$subCategoryResult = mysql_query("SELECT * FROM sub_category WHERE cat_id='".$cat_id."' ORDER BY id");
?>
<div class='col-lg-12'>
<?php
while($subCategoryRow = mysql_fetch_assoc($subCategoryResult)){
echo "<h3 class='cd-box cd-header'>asd".$SubCategoryRow[2]."</h3>";
}
?>
</div>
现在,这个查询显示7 H3标签,如果7条记录在数据库中,但对于$ SubCategoryRow不显示任何东西[2]。它显示空白...任何帮助?
答
查找变种名称:$ 小号 ubCategoryRow和$ 小号 ubCategoryRow
停止使用'mysql_ *'功能。自从时代开始,它们就被弃用了! – hjpotter92
你的数据库结构有多少cols? –
也在'$ subCategoryRow'中的大写“s”。错字? –