php留言板顯示不了使用者解決辦法

來源:互聯網
上載者:User
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'];
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.