php实现留言板修改留言的方法:首先连接数据库并选择指定的数据库;然后设置输出编码;接着记录表单提交的修改过的留言板内容;最后执行相应的sql语句即可。
推荐:《php视频教程》
数据库为notebook表为noteinfo留言板标题字段为title留言内容的标题为content
代码如下:
mysql_connect("数据库地址","数据库用户","数据库密码"); //链接数据库or die("can not connect to db");mysql_select_db("noteinfo"); //选择noteinfo数据库or die("can not select the db ");mysql_query("set names gb2312"); //设置输出编码$title = $_post['title'];//记录表单提交的要修改的标题$newcontent = $_post[''content];//记录表单提交的的修改过的留言板内容(name = content)$sql = "update noteinfo set content = '$newcontent' where title = ‘$title’ "; //定义sql语句$myquery = mysql_query($sql);//执行sql语句,也就是修改content为$newcontent。//哦了!
以上就是php如何实现留言板修改留言的详细内容。