php实例-注册&登录
程序员文章站
2022-05-03 16:49:28
...
------------------------Re.php---------------------------------
-------------------------------------register.php------------------------------------
--------------------------select.php-----------------------------------
Register 用户注册
-------------------------------------register.php------------------------------------
Register query($query); if($result) { echo "注册成功!
"; } else { echo "注册失败!"; } $db->close(); ?> 点击登录
--------------------------select.php-----------------------------------
$c //连接并选择数据库服务器 mysql_query("set names utf8"); mysql_select_db("cookie",$connection); $proid = $_GET["province"]; if(isset($proid)){ $q=mysql_query("select * from city where provinceid = $proid"); while($row=mysql_fetch_array($q)){ $select[] = array("cityid"=>$row[cityid],"city"=>$row[city]); } //var_dump($select); echo json_encode($select); } ?>
-----------------login.html----------------------------
Login 用户登录
------------------------login.php-------------------------------------
Login query($query); $num_results = $result->num_rows; if($num_results >0) { //echo "登录成功!"; include "userinfo.php"; } else { echo "用户名或密码错误,请确认!"; } $db->close(); ?>
-----------------------------userinfo.php----------------------------------
Login left join gender as g on u.genderid = g.genderid left join province as p on u.provinceid = p.provinceid left join city as c on u.cityid = c.cityid left join department as d on u.departmentid = d.departmentid left join positions as po on u.positionid = po.positionid"; $result=mysql_query($query,$connection); ?>
用户ID | 工号 | 真实姓名 | 性别 | 省份 | 城市 | 部门 | 职位 | 备注 | 操作 |
---|---|---|---|---|---|---|---|---|---|
echo $row[userid]." "; ?> |
echo $row[userno]." "; ?> |
echo $row[username]." "; ?> |
echo $row[gender]." "; ?> |
echo $row[province]." "; ?> |
echo $row[city]." "; ?> |
echo $row[department]." "; ?> |
echo $row[positions]." "; ?> |
echo $row[remark]." "; ?> |
编辑 | } ?>
上一篇: PHP常用数组函数介绍
下一篇: PHP 表单防止刷新提交的方法
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论