/**
* 修改管理员
*/
function editAdmin($id){
$arr = $_POST;
$arr['password'] = md5($_POST['password']);
// $mes = update("shop_admin", $arr,"id = {$id}");
// var_dump($mes);
// print_r($mes);
if (update("shop_admin", $array,"id = {$id}")) {
$mes = "修改成功! <br/><a href='listAdmin.php'>查看管理员</a>";
}else {
$mes = "修改失败!<br/><a href='listAdmin.php'>重新修改</a>";
}
return $mes;
}
/**
* 更新操作
*/
function update($table,$array,$where=null){
$link = connect();
$str = "";
foreach ((array)$sxh as $key => $val){
if ($str==null){
$sep="";
}else{
$sep=",";
}
$str = $sep.$key."='".$val."'";
}
$sql="update $table set $str ".($where==null?null:" where ".$where);
print_r($sql);
mysqli_query($link, $sqli);
return mysqli_affected_rows($link);
}