自己为了老师的课程设计做的小东西。
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
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