Home  >  Article  >  Backend Development  >  php mysql_fetch_array()和 mysql_fetch_row()的报错的问题???新手求教

php mysql_fetch_array()和 mysql_fetch_row()的报错的问题???新手求教

WBOY
WBOYOriginal
2016-06-23 13:39:15887browse

这是我分页代码
function setSQL($sql){
$awal=(!empty($_GET[$this->param1]) && is_numeric($_GET[$this->param1])) ? intval($_GET[$this->param1]) : 0;
$hal =(!empty($_GET[$this->param2]) && is_numeric($_GET[$this->param2])) ? intval($_GET[$this->param2]) - 1 : 0;

$src = (preg_match("/.+FROM.+/",$sql)) ? "FROM" : "from";
$expsql = substr( $sql , strpos($sql,$src) + strlen($src) , strlen($sql) - 1 );

$koneksi = mysql_query("SELECT COUNT(*) FROM ".$expsql);


$having = strpos(strtolower($expsql), $condition_sql);
if($having===false)
{
list($jumlah) = mysql_fetch_row($koneksi)   //这里报错显示
}
else
{
$jumlah = mysql_num_rows($koneksi);
}

$this->numRows = $jumlah;
 
$koneksi = mysql_query($sql." LIMIT $awal,$this->totalRecordPage");

$data = array();
while($row = mysql_fetch_array($koneksi)){      //这里报错显示[/color]
$data[] = $row;
}



这里调用分页的
if($day==6){//21
$date1=date("Y-m-d",mktime(0, 0, 0,date("m"),date("d")-date("w")-0,date("Y")));   
$date2=date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-date("w")+0,date("Y")));  
 $sql="SELECT a.period,a.type1,a.type2,a.result,a.open_time FROM mme1_

}
if($day==7){//22
$date1=date("Y-m-d",mktime(0, 0, 0,date("m"),date("d")-date("w")-0,date("Y")));   
$date2=date("Y-m-d H:i:s",mktime(23,59,59,date("m"),date("d")-date("w")+0,date("Y")));  
 $sql="SELECT a.period,a.type1,a.type2,a.result,a.open_time FROM mme2_

}
$pg = new Pagging("resulttext2.php?page=".$_GET['page']."");
$pg->totalRecordPage = 25;
$pg->setSQL($sql);
好像


回复讨论(解决方案)

错误信息是什么? 贴出来看看。

看看报什么错?

Warning: mysql_fetch_row() expects parameter 1 to be resource, boolean given in S:\website\malaysia\config\page.inc.php on line 111

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in S:\website\malaysia\config\page.inc.php on line 127

分页显示出来2页··我点第二页就报错了····我看日志点击第二页时只获取了SELECT COUNT(*) FROM     。。。。后面没语句了就

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn