日期:2014-05-17 浏览次数:20572 次
<?php
/* Created on [2012-5-17] */
#所有信息
$sql = "select * from role_table where role_id!=0";
$re = mysql_query($sql);
if (!$re)
die("SQL:{$sql}<br>Error:" .
mysql_error());
if (mysql_affected_rows() > 0) {
$allinfors = array ();
while ($rows = mysql_fetch_array($re)) {
array_push($allinfors, $rows);
}
}
#要修改信息
$sql2 = "select * from sub_role_table where id='$id'";
$res = mysql_query($sql2);
if (!$re)
die("SQL:{$sql}<br>Error:" .
mysql_error());
if (mysql_affected_rows() > 0) {
$editinfor = mysql_fetch_array($res);
}
?>
<?php foreach($allinfors as $all){ ?>
<input type="checkbox" name="item[]" value="<?=$all['role_id']?>" <?=($all['role_id']==$editinfor['role_id'])?"checked=checked":""?> /><?=$all['role_name']?>
<?php } ?>