PHP100视频教程第11讲 正确代码
conn.php 文件
$conn = @ mysql_connect("localhost", "root", "") or die("数据库链接错误");
mysql_select_db("newdb", $conn);
mysql_query("set names 'GBK'"); //使用GBK中文编码;
?>
add.php 文件
include ("conn.php");
if(isset($_POST['submit']) && $_POST['submit']) //吧if($_post['submit'])替换矫正Notice: Undefined index: submit in 错误
{
$sql_add="insert into message (id,user,title,content,lastdate) values ('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
mysql_query($sql_add);
echo "发表成功";
}
?>
| 标题:=$row['title']?> 用户:=$row['user']?> |
| 内容:=$row['content']?> |
PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号