自己做的一个简单的用户管理(PHP)!

这是一个用于课程设计的PHP用户管理系统,包括数据库设计、用户查询、添加、修改和删除功能。使用MySQL作为数据库,通过PHP连接并操作数据。用户可以通过ID、用户名、年龄或性别进行查询,系统会自动跳转到相应页面完成操作,并在5秒后返回主页。
摘要由CSDN通过智能技术生成
  自己为了老师的课程设计做的小东西。
1)。数据库(MYSQL):
    use test;
    create table if not exists user(
    id int auto_increment not null,
    username varchar(20) not null,
    age int  not null,
    sex char(1) not null);
    数据库连接(test3con.php):
    <?php
    $link=mysql_connect("localhost","root","123");
    if(!link) die ("Could not connect to MySQL");
    mysql_select_db("test",$link) or die ("Could not open db".mysql_error());
    ?>
   
    主页为(test3.php):
    <?php
    include("test3con.php");
    ?>
    <center>
    用户管理系统
    <hr>
    <?php
        $query_count="select count(*) from user";
        $result_count=mysql_query($query_count,$link);
        $count=mysql_result($result_count,0);
    ?>
    <table>
    <tr>
    <td align="right">
    总的用户数:<font color="red"><?php echo $count; ?></font>|<a href="add.php">添加新用户</a>
    </td>
    <tr><td>
        <table>
        <th align="right">ID</th><th align="right">姓名</th><th align="right">年龄</th><th align="right">性别    </th><th align="right">修改</th><th align="right">删除</th>
        <?php
            $query="select * from user order by id";
            $result=mysql_query($query,$link);
            while($a_rows=mysql_fetch_object($result))
            {
        ?>
                <tr>
                <td align="right" width="100"><?php echo $a_rows->id ?></td>
                <td align="right" width="100"><?php echo $a_rows->username ?></td>
                <td align="right" width="100"><?php echo $a_rows->age ?></td>
                <td align="right" width="100"><?php echo $a_rows->sex ?></td>
                <td align="right" width="100"><a href="modify.php?id=<?php echo $a_rows->id ?>">修改</a></td>
                <td align="right" width="100"><a href="delete.php?id=<?php echo $a_rows->id ?>">删除</a></td>
                </tr>               
        <?php
            }
                mysql_close($link);
        ?>
        <tr><br>
            <td align="righ
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值