如何做写一套图书馆管理系统(二-二)读者管理模块

昨天写完了读者档案管理模块。

为了更好的对读者进行管理,我们需要再加一个读者类型管理模块。

目的是为了给不同的读者,不同的权限。

那么读者的权限包括什么呢?

1、借书数量不同

2、借阅保存时间不同

暂时就这两种了。

所以读者类型表的字段分别是:读者类型、借书量、借阅时间,加一个id吧,反正字段少。

实例上都只有一个借书量的区别。都没借阅时间的差异,那就先不做这个吧。

create table readertypes(
	id int(10) primary key auto_increment,
	Rtypename varchar(100),
	bookstorenum int(10)
)
1.readertypes.php

<html>
	<head>
		<title>读者类型管理</title>
	</head>
	<body>
		<a href = "readertypes_add.php">添加读者类型</a>
		<table>
			<tr>
				<th>读者类型</th>
				<th>可借书目</th>
				<th>操作</th>
			</tr>
			<?php
				include "conn/conn.php";
				$sql = mysql_query("select * from readertypes;");
				$info = mysql_fetch_array($sql);
				if($info == false)
					echo "No readertypes!";
				do{
			?>
			<tr>
				<td><?php echo $info['Rtypename'];?></td>
				<td><?php echo $info['bookstorenum'];?></td>
				<td><a href = "readertypes_modify.php?id=<?php echo $info['id']?>">
				修改</a></td>
				<td><a href = "readertypes_delete.php?id=<?php echo $info['id']?>">删除</a></td>
			</tr>
			<?php
				}while($info = mysql_fetch_array($sql)); 
			?>
		</table>
	</body>
</html>
2.readertypes_add.php
<html>
	<head>
		<title>添加读者档案</title>
	</head>
	<body>
		<form action = "readertypes_add_ok.php" method = "POST">
		<label>读者类型</label>
		<input type = "text" name = "readertype"></input></br>
		<label>可借书数目</label>
		<input type = "text" name = "bookstorenum"></input></br>
		<button type = "submit" >提交</button>
		<input name="Submit2" type="button" value="返回" onClick="history.back();">
	</body>
</html>
3.readertypes_add_ok.php
<?php
	include "conn/conn.php";
	$readertype = $_POST['readertype'];
	$bookstorenum = $_POST['bookstorenum'];
	echo $readertype,$bookstorenum;
	mysql_query("insert into readertypes (Rtypename,bookstorenum)values('$readertype','$bookstorenum')");
	echo "<script language='javascript'>alert('读者类型添加成功!');history.back();</script>";
?>
4.readertypes_modify.php
<html>
	<head>
		<title>修改读者类型权限</title>
	</head>
	<body>	
		<?php
			include "conn/conn.php";
			$id = $_GET['id'];
			$sql = mysql_query("select * from readertypes where id = '$id';");
			$info = mysql_fetch_array($sql)//即便我只查一条,我也用这个方法了。
		?>
		<form action = "readertypes_modify_ok.php?id=<?php echo $id?>" method = "POST">
		<label>读者类型</label>
		<input type ="text" name ="readertype" value = "<?php echo $info['Rtypename'];?>"></input></br>
		<label>可借书目数量</label>
		<input type = "text" name = "bookstorenum" value = "<?php echo $info['bookstorenum'];?>"></input></br>
		<button type = "submit" >提交</button>
		<input name="Submit2" type="button" value="返回" onClick="history.back();">
		</form>
	</body>
</html>
5.readertypes_modify_ok.php
<?php
	include "conn/conn.php";
	$id = $_GET['id'];
	$readertype = $_POST['readertype'];
	$bookstorenum = $_POST['bookstorenum'];
	//$signtime = $_POST['signtime'];
	$sql = mysql_query("update readertypes set Rtypename = '$readertype',bookstorenum = '$bookstorenum' where id = '$id';");
	echo "<script language='javascript'>alert('读者类型权限修改成功!');history.back();</script>";
?>
6.readertypes_delete.php

<?php
	$id = $_GET['id'];
	include "conn/conn.php";
	$sql = mysql_query("delete from readertypes where id = '$id';");
	echo "<script language='javascript'>alert('读者类型删除成功!');history.back();</script>";
?>
功能模块基本完成。






评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值