欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

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

程序员文章站 2022-05-30 22:23:46
...
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);
?>