getRowsArray($sql);$smarty->assign("array1","/> getRowsArray($sql);$smarty->assign("array1",">

Home  >  Article  >  Backend Development  >  php查询数据有关问题

php查询数据有关问题

WBOY
WBOYOriginal
2016-06-13 10:21:32932browse

php查询数据问题
$sql = "select * from db_news_type where flag = '".$flag."' order by px,id";
$row=$conne->getRowsArray($sql);
$smarty->assign("array1",$row);
$pageSize=4; //设置每页记录数
$sql1="select guid,n_class,title,px,pic,date,flag from db_news where flag = '".$flag."' order by px,guid desc limit ".($pageSize * ((empty($_REQUEST['page']) ? 1 : $_REQUEST['page'])-1)).", ".$pageSize;
$sql2="select guid,flag from db_news where flag = '".$flag."'";
$news_array=$conne->getRowsArray($sql1); 
$news_array1=$conne->getRowsArray($sql2);
echo $sql1;
$page_url="news_info.php"; //页面url地址
$totalnumber=count($news_array1); //获得总记录数
$midPage=5; //数字导航链接数
page();// 调用分页函数
$smarty->assign("array2",$news_array);


问题是通过foreach遍历array2时把$row也遍历了,请高用解决

------解决方案--------------------
帮顶 额外
------解决方案--------------------
楼主没有说清你的问题呀,最好把前台代码也贴进来。

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