<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<?php
include ("conn.php");
if($_POST['submit']){
$sql="insert into message (id,user,title,content,lastdate)".
"values('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
mysql_query($sql);
mysql_close();
echo '成功';
}
?>
</body>
</html>它只执行include ("conn.php");显示一个空的页面不再往下执行。
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head><body>
<?php
include ("conn.php");
if($_POST['submit']){
$sql="insert into message (id,user,title,content,lastdate)".
"values('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
mysql_query($sql);
mysql_close();
echo '成功';
}
?>
</body>
</html>它只执行include ("conn.php");显示一个空的页面不再往下执行。
include ("conn.php");
echo "1";
if($_POST['submit']){
$sql="insert into message (id,user,title,content,lastdate)".
"values('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
mysql_query($sql);
mysql_close();
echo '成功';
}
echo "2";
?>
试下到哪挂了
我的conn.php是:
<?php
$conn=@ mysql_connect("localhost",'root','050203') or die("数据库连接失败!");
mysql_select_db('db',$conn);
mysql_query("set names 'GBK'");
?>
然后在运行下你的程序 看看报错啥
它提示只个错误
"values('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
输出的值是:insert into message (id,user,title,content,lastdate)values('','f','f','f',now())
这里的now()为什么没有显示值呀。
估计是语法错误。now是mysql的函数,你这里看不到值的