"/> ">
Maison >développement back-end >tutoriel php >PHP里的sql有关问题
PHP里的sql问题
<br />//查询<br /> $sql="SELECT * FROM `rv_duifu` where 1=1 $search order by id desc LIMIT $pageNum,$numPerPage";<br /> $db->query($sql);<br /> $list=$db->fetchAll();<br /> <br /> //echo $sql;<br /> //格式化输出数据<br /> foreach($list as $key=>$val){<br /> if($key%2==0){<br /> $list[$key][rowcss]="listOdd";<br /> }else{<br /> $list[$key][rowcss]="listEven";<br /> }<br /> $sql_lc="select * from `rv_licai` where id='".$list[$key][licaiid]."' limit 1";<br /> $db->query($sql_lc);<br /> $row_lc=$db->fetchRow();<br /> $list[$key][name_txt]=$row_lc['name'];<br /> $list[$key][qixian_txt]=$row_lc['qixian'];<br /> $list[$key][bdate_txt]=$row_lc['bdate'];<br /> $list[$key][ldate_txt]=$row_lc['ldate'];<br /> $list[$key][jine_txt]=$row_lc['jine'];<br /> }<br /><br /> //模版<br /> $smt = new smarty();smarty_cfg($smt);<br /> $smt->assign('list',$list);<br /> $smt->assign('numPerPage',$_POST[numPerPage]); //显示条数<br /> $smt->assign('pageNum',$_POST[pageNum]); //当前页数<br /> $smt->assign('total',$total);<br /> $smt->assign('title',"列表");<br /> $smt->display('duifu_list.htm');<br />