写了一个小程序,用到了如下代码
<?php $sqlsc1="select * from t_paper_choice,t_choice,t_chapter,t_chapter_extent where t_paper_choice.N_PAPER_ID='$N_PAPER_ID' and t_paper_choice.N_CHOICE_ID=t_choice.N_CHOICE_ID and t_choice.N_CHOICE_TYPE=0 and t_choice.N_CHAP_ID=t_chapter.N_CHAP_ID and t_chapter.N_CEXTEND_ID=t_chapter_extent.N_CEXTEND_ID";
$rssc1=mysql_query($sqlsc1,$conn) or die ("<br>数据表无记录<br>");
$recordsc=mysql_fetch_array($rssc1);
print_r($rssc1);
?>查询没有提示“数据表无记录”,但是就是没有打印出查询结果,请大家帮我看看看是怎么回事啊
<?php $sqlsc1="select * from t_paper_choice,t_choice,t_chapter,t_chapter_extent where t_paper_choice.N_PAPER_ID='$N_PAPER_ID' and t_paper_choice.N_CHOICE_ID=t_choice.N_CHOICE_ID and t_choice.N_CHOICE_TYPE=0 and t_choice.N_CHAP_ID=t_chapter.N_CHAP_ID and t_chapter.N_CEXTEND_ID=t_chapter_extent.N_CEXTEND_ID";
$rssc1=mysql_query($sqlsc1,$conn) or die ("<br>数据表无记录<br>");
$recordsc=mysql_fetch_array($rssc1);
print_r($rssc1);
?>查询没有提示“数据表无记录”,但是就是没有打印出查询结果,请大家帮我看看看是怎么回事啊
..
..
$recordsc=mysql_fetch_array($rssc1);
//print_r($rssc1);//你print_r($rssc1)干嘛?
print_r($recordsc)
$recordsc=mysql_fetch_array($rssc1);
print_r($rssc1);
改为:
$rssc1=mysql_query($sqlsc1,$conn) or die ("<b>SQL语句执行失败!<b>");
while($recordsc=mysql_fetch_array($rssc1))//必须用循环来遍历一下!
{
echo $rssc1['数据库里的字段名1'].$rssc1['数据库里的字段名2']; //循环显示出字段值!
}
改为:
$rssc1=mysql_query($sqlsc1,$conn) or die ("<b>SQL语句执行失败!<b>");
while($recordsc=mysql_fetch_array($rssc1))//必须用循环来遍历一下!
{
echo $$recordsc['数据库里的字段名1'].$recordsc['数据库里的字段名2']; //循环显示出字段值!
}