当前位置:Gxlcms > PHP教程 > 报表-php读取数据库报错,读取不出来(附源代码)

报表-php读取数据库报错,读取不出来(附源代码)

时间:2021-07-01 10:21:17 帮助过:2人阅读

php报表数据库

提示错误:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\yxweb\yjjh\B\dis_ck.php on line 47

起没查询前期报表

源码:
date_default_timezone_set('Asia/Shanghai');//Asia/Shanghai
$sj=date("Y-m-d");//取前期
//echo $sj;
$gq=0;
$bb=0;
if(!empty($_POST['sj'])){
$sj=$_POST['sj'];
//$sj="$sj[6]"."$sj[7]"."$sj[8]"."$sj[9]"."-"."$sj[0]"."$sj[1]"."-"."$sj[3]"."$sj[4]";
}
if(!empty($_POST['gq'])){
$gq=$_POST['gq'];
}
if(!empty($_POST['bb'])){
$bb=$_POST['bb'];
}
//echo"

$sj, $gq, ";
$sql=mysql_query("select * from $bb where gq='$gq' and sj like'$sj%' order by id desc ");
$info=mysql_fetch_array($sql);
if($info==false){

//echo"

$array

";

echo "

起没查询前期报表

";
}
elseif($bb=='yl'){
$sqlyl=mysql_query("select * from yl where gq='$gq' and sj like '$sj%' order by id desc limit 1");
//echo $sqlfzb;
$info=mysql_fetch_array($sqlyl);
?>

人气教程排行