php留言板显示不了用户
(这个不知道有传上图片) 我的留言板里,留言了,但是留言人没显示出来。。我发现不了 - -!求指点、。。。代码奉上(不知道是这段代码不) (我的数据库也没用户名,也是空白的)
<?php
/*
* Created on 2012-3-23
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
include_once("comm.php");
$conn = mysql_connect("localhost","root","123456") or die("无法建立连接!");
mysql_select_db("lyb") or die(mysql_error()."数据库无法打开");
$title = $_POST['title'];
$type = $_POST['type'];
$content = $_POST['content'];
$date_time = date("Y-m-d H:m:s");
$author = $_SESSION['user'];
if($content!="" and $title!=""){
$sql = "insert into lyb_table (subject,type,content,publish_time,user) values('$title','$type','$content','$date_time','$author')";
mysql_query("set names 'gb2312'");
mysql_query($sql,$conn);
get_show_msg("lyb.php","留言成功!");
}else{
get_show_msg("lyb.php","留言填写错误,请重新填写!");
}
mysql_close($conn);
?>
[解决办法]
session_start()未开启;我看你插入数据库的字段名是user,你输出$row['author'];