如何实现循环?紧急情况,告急!!!! 大部分使用模板的PHP里都有解决这种问题的现成代码,拷贝来用用就好。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <?php require_once("../inc/define.inc.php"); require_once("../inc/checklogin.inc.php"); require_once("../inc/page.inc.php"); require_once "fasttemplate/class.FastTemplate.php3"; $oper = $_GET["oper"]; if($oper == "delete") { $Users = $_POST["users"]; DeleteUsers($Users); header("location:regmessage.php?status=12"); } $type = $_GET["type"]; if($type == "confirm") { $id = $_GET["id"]; ConfirmMember($id); echo "<script language='javascript'>alert(\"批准成功!\");window.location='user_list.php';</script>"; exit(); } //check oper $tpl=new FastTemplate("./tpl"); $tpl->define(array(main => "user_list.tpl")); $tpl->define_dynamic("row2","main"); /************* show page*********************************************************************/ set_time_limit(0); $pagesize=20; $Page = $_GET["pagecount"]; if(!isset($Page)) { $Page = 1; } $show_start = ($Page -1 )*$pagesize; $p=new show_page; $p->pvar="pagecount"; $where = ""; GetUserInfo(&$Userinfo,&$totle_num, $pagesize, $Page); if($totle_num == 0) { header("location:regmessage.php?status=5"); exit(); } $p->set($pagesize,$totle_num); for($i=0;$i< $pagesize;$i++) { if($show_start < $totle_num) { $sub = $Userinfo[$i][Subsibe] == 1 ? "是" : "否"; $id = $Userinfo[$i][User_id]; if($Userinfo[$i][User_status] == 1) { $sub = "<a href='user_list.php?id=$id&type=confirm'>批准</a>"; } $tpl->assign(USER_ID, $Userinfo[$i][User_id]); $tpl->assign(USER_NAME, $Userinfo[$i][User_name]); $tpl->assign(USER_TYPE, $UserType[$Userinfo[$i][User_type]]); $tpl->assign(SUBSIBE, $sub); $tpl->assign(USER_EMAIL, $Userinfo[$i][User_email]); $tpl->assign(LAST_LOGIN_TIME, $Userinfo[$i][Last_login_time]); $show_start++; $tpl->parse(ROW2,".row2"); } } $showpage=$p->output(1); $tpl->assign(SHOWPAGE,$showpage); $tpl->parse(BODY,"main"); $tpl->FastPrint("BODY"); ?> <table class="showframe" width="750"> <tr> <td width="140" class="showhd" align="center">用户名</td> <td width="100" class="showhd" align="center">用户类型</td> <td width="100" class="showhd" align="center">付费会员</td> <td width="120" class="showhd" align="center">用户EMAIL</td> <td width="180" class="showhd" align="center">上次登录时间</td> <td width="100" class="showhd" align="center">详细信息</td> </tr> </table> <div id="divAll"> <table class="showdata" width="750"> <!-- BEGIN DYNAMIC BLOCK: row2 --> <tr> <td width="5" class="showtd"> <input type="checkbox" name="users[]" value="{USER_ID}"></td> <td width="135" class="showtd" align="center">{USER_NAME}</td> <td width="140" class="showtd" align="center">{USER_TYPE}</td> <td width="120" class="showtd" align="center">{SUBSIBE}</td> <td width="120" class="showtd" align="center">{USER_EMAIL}</td> <td width="180" class="showtd" align="center">{LAST_LOGIN_TIME}</td> <td width="100" class="showtd" align="center"><a href="user_add.php?type=edit&User_id={USER_ID}">详细信息</a></td> </tr> <!-- END DYNAMIC BLOCK: row2 --> 连分页都有了!用的是fasttemplate <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><link rel="stylesheet" type="text/css" href="../css/main1.css"><title>网址列表</title><script language="javascript" src="../js/function.js"></script><script language="javascript" > function User_add(myform) { myform.action = "user_add.php?oper=add"; myform.submit(); } function User_delete(myform) { var length = divAll.all.length; var checkedcount=0; for(i=0;i<length;i++) { if(divAll.all(i).type == "checkbox") { if(divAll.all(i).checked == true) { checkedcount += 1; } } } if(checkedcount == 0) { alert("请选择一个要删除的用户!"); return; } if(confirm("确定要删除用户吗?")) { myform.action = "user_list.php?oper=delete"; myform.submit(); } } </script></head><body bgcolor="99ccff"><form name="myform" action="" method="post"><table border="0" width="750" > <tr> <td colspan="2" height="30"> <font class="showtitle">系统管理>>用户管理</font> </td> <tr></table><table> <tr> <td width="10"> </td> <td > <table class="showframe" width="750"> <tr> <td width="140" class="showhd" align="center">用户名</td> <td width="100" class="showhd" align="center">用户类型</td> <td width="100" class="showhd" align="center">付费会员</td> <td width="120" class="showhd" align="center">用户EMAIL</td> <td width="180" class="showhd" align="center">上次登录时间</td> <td width="100" class="showhd" align="center">详细信息</td> </tr> </table> <div id="divAll"> <table class="showdata" width="750"> <!-- BEGIN DYNAMIC BLOCK: row2 --> <tr> <td width="5" class="showtd"> <input type="checkbox" name="users[]" value="{USER_ID}"></td> <td width="135" class="showtd" align="center">{USER_NAME}</td> <td width="140" class="showtd" align="center">{USER_TYPE}</td> <td width="120" class="showtd" align="center">{SUBSIBE}</td> <td width="120" class="showtd" align="center">{USER_EMAIL}</td> <td width="180" class="showtd" align="center">{LAST_LOGIN_TIME}</td> <td width="100" class="showtd" align="center"><a href="user_add.php?type=edit&User_id={USER_ID}">详细信息</a></td> </tr> <!-- END DYNAMIC BLOCK: row2 --> </table> </div> </td> </tr></table><table> <tr> <td width="580" align="center"> <font class="normal">{SHOWPAGE}</font></form> </td> </tr></table><br><table> <tr> <td width="580" align="center"> <!--input type="submit" class="showbuttons" value="添加用户" onclick="User_add(myform)"--> <input type="submit" class="showbuttons" value="删除用户" onclick="User_delete(myform)"> </td> </tr></table></form></body></html>晕,没有发完! 用smarty的循环也很简单{secion name=i loop=$value}<tr><td>{$value[i]['name']}</td><td>{$value[i]['id']}</td><td>{$value[i]['info']}</td></tr>{/section} 循环输出时或许id值 从数据库中取出的中文,不能再网页上显示?而且也无法在语句中用==进行比较? 自己写一个php程序,为什么执行久了就500错误 问一个问题 LAMP下开发关于git版本控制器的问题? 我想装php环境,装哪个版本,从哪下载呀? 每次都要右键,烦死了,求批处理方法执行版本管理。 如何让html文件中的php代码被执行? 有谁用过 ips 付费系统 PHP 页面嵌入的php代码不执行问题 Javascript如何操作Cookie? 【200分】问个我这种有限分类的显示树的方法和找到某一层的方法
require_once("../inc/define.inc.php");
require_once("../inc/checklogin.inc.php");
require_once("../inc/page.inc.php");
require_once "fasttemplate/class.FastTemplate.php3";
$oper = $_GET["oper"];
if($oper == "delete")
{
$Users = $_POST["users"];
DeleteUsers($Users);
header("location:regmessage.php?status=12");
}
$type = $_GET["type"];
if($type == "confirm")
{
$id = $_GET["id"];
ConfirmMember($id);
echo "<script language='javascript'>alert(\"批准成功!\");window.location='user_list.php';</script>";
exit();
}
//check oper
$tpl=new FastTemplate("./tpl");
$tpl->define(array(main => "user_list.tpl"));
$tpl->define_dynamic("row2","main");
/************* show page*********************************************************************/
set_time_limit(0);
$pagesize=20;
$Page = $_GET["pagecount"];
if(!isset($Page))
{
$Page = 1;
}
$show_start = ($Page -1 )*$pagesize;
$p=new show_page;
$p->pvar="pagecount";
$where = "";
GetUserInfo(&$Userinfo,&$totle_num, $pagesize, $Page);
if($totle_num == 0)
{
header("location:regmessage.php?status=5");
exit();
}
$p->set($pagesize,$totle_num);
for($i=0;$i< $pagesize;$i++)
{
if($show_start < $totle_num)
{
$sub = $Userinfo[$i][Subsibe] == 1 ? "是" : "否";
$id = $Userinfo[$i][User_id];
if($Userinfo[$i][User_status] == 1)
{
$sub = "<a href='user_list.php?id=$id&type=confirm'>批准</a>";
}
$tpl->assign(USER_ID, $Userinfo[$i][User_id]);
$tpl->assign(USER_NAME, $Userinfo[$i][User_name]);
$tpl->assign(USER_TYPE, $UserType[$Userinfo[$i][User_type]]);
$tpl->assign(SUBSIBE, $sub);
$tpl->assign(USER_EMAIL, $Userinfo[$i][User_email]);
$tpl->assign(LAST_LOGIN_TIME, $Userinfo[$i][Last_login_time]);
$show_start++;
$tpl->parse(ROW2,".row2");
}
}
$showpage=$p->output(1);
$tpl->assign(SHOWPAGE,$showpage);
$tpl->parse(BODY,"main");
$tpl->FastPrint("BODY");
?>
<table class="showframe" width="750">
<tr>
<td width="140" class="showhd" align="center">用户名</td>
<td width="100" class="showhd" align="center">用户类型</td>
<td width="100" class="showhd" align="center">付费会员</td>
<td width="120" class="showhd" align="center">用户EMAIL</td>
<td width="180" class="showhd" align="center">上次登录时间</td>
<td width="100" class="showhd" align="center">详细信息</td>
</tr>
</table>
<div id="divAll">
<table class="showdata" width="750">
<!-- BEGIN DYNAMIC BLOCK: row2 -->
<tr>
<td width="5" class="showtd"> <input type="checkbox" name="users[]" value="{USER_ID}"></td>
<td width="135" class="showtd" align="center">{USER_NAME}</td>
<td width="140" class="showtd" align="center">{USER_TYPE}</td>
<td width="120" class="showtd" align="center">{SUBSIBE}</td>
<td width="120" class="showtd" align="center">{USER_EMAIL}</td>
<td width="180" class="showtd" align="center">{LAST_LOGIN_TIME}</td>
<td width="100" class="showtd" align="center"><a href="user_add.php?type=edit&User_id={USER_ID}">详细信息</a></td>
</tr>
<!-- END DYNAMIC BLOCK: row2 -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" type="text/css" href="../css/main1.css">
<title>网址列表</title>
<script language="javascript" src="../js/function.js"></script>
<script language="javascript" >
function User_add(myform)
{
myform.action = "user_add.php?oper=add";
myform.submit();
}
function User_delete(myform)
{
var length = divAll.all.length;
var checkedcount=0;
for(i=0;i<length;i++)
{
if(divAll.all(i).type == "checkbox")
{
if(divAll.all(i).checked == true)
{
checkedcount += 1;
}
}
}
if(checkedcount == 0)
{
alert("请选择一个要删除的用户!");
return;
}
if(confirm("确定要删除用户吗?"))
{
myform.action = "user_list.php?oper=delete";
myform.submit();
}
}
</script>
</head>
<body bgcolor="99ccff">
<form name="myform" action="" method="post"><table border="0" width="750" >
<tr>
<td colspan="2" height="30">
<font class="showtitle">系统管理>>用户管理</font>
</td>
<tr>
</table>
<table>
<tr>
<td width="10">
</td>
<td >
<table class="showframe" width="750">
<tr>
<td width="140" class="showhd" align="center">用户名</td>
<td width="100" class="showhd" align="center">用户类型</td>
<td width="100" class="showhd" align="center">付费会员</td>
<td width="120" class="showhd" align="center">用户EMAIL</td>
<td width="180" class="showhd" align="center">上次登录时间</td>
<td width="100" class="showhd" align="center">详细信息</td>
</tr>
</table>
<div id="divAll">
<table class="showdata" width="750">
<!-- BEGIN DYNAMIC BLOCK: row2 -->
<tr>
<td width="5" class="showtd"> <input type="checkbox" name="users[]" value="{USER_ID}"></td>
<td width="135" class="showtd" align="center">{USER_NAME}</td>
<td width="140" class="showtd" align="center">{USER_TYPE}</td>
<td width="120" class="showtd" align="center">{SUBSIBE}</td>
<td width="120" class="showtd" align="center">{USER_EMAIL}</td>
<td width="180" class="showtd" align="center">{LAST_LOGIN_TIME}</td>
<td width="100" class="showtd" align="center"><a href="user_add.php?type=edit&User_id={USER_ID}">详细信息</a></td>
</tr>
<!-- END DYNAMIC BLOCK: row2 -->
</table>
</div>
</td>
</tr>
</table>
<table>
<tr>
<td width="580" align="center">
<font class="normal">{SHOWPAGE}</font></form>
</td>
</tr>
</table>
<br>
<table>
<tr>
<td width="580" align="center">
<!--input type="submit" class="showbuttons" value="添加用户" onclick="User_add(myform)"-->
<input type="submit" class="showbuttons" value="删除用户" onclick="User_delete(myform)">
</td>
</tr>
</table>
</form>
</body>
</html>
晕,没有发完!
{secion name=i loop=$value}
<tr>
<td>{$value[i]['name']}</td><td>{$value[i]['id']}</td><td>{$value[i]['info']}</td>
</tr>
{/section}