php查詢資料有關問題

來源:互聯網
上載者:User
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也遍曆了,請高用解決

------解決方案--------------------
幫頂 額外
------解決方案--------------------
樓主沒有說清你的問題呀,最好把前台代碼也貼進來。
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.