PHP简单留言本的制作(五)

王朝php·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

留言在数据库的保存:(数据库的修改)

<?

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());

?>

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航