|
|
PHP简单留言本的制作(五) |
|
|
作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站 |
留言在数据库的保存:(数据库的修改)
<? function err_output($errstr="未知错误!") { echo "<div align='center'> <TABLE cellSpacing=0 cellPadding=0 width='70%' align=center border=0> <tbody> <tr><td>输入有误!<b>$errstr</b><br><br>请点击这里<a href=javascript:history.go(-1);>返回</a></td></tr> </tbody> </TABLE> </div><br><br><br><DIV id=bottom> </DIV>"; exit(); } $db=mysql_connect("localhost","huqingsql","000000") or err_output("无法连数据库!"); mysql_select_db("huqingsql") or err_output("无法选择数据库!"); //用户点击添加按钮 if($add) { //合法性检验 if(empty($name)||empty($title)||empty($message)) { err_output("姓名/标题/留言内容不能为空!"); } $face="<img height=100 width=100 src=images/".$face." border=0>"; $posttime=date("Y-m-d G:i:s"); mysql_query("insert into guestbook values(0000,'$name','$title','$posttime','$weather','$message','$face','$smile')") or die(mysql_error()); ?>
|
|
相关文章:相关软件: |
|