我們正在與PHP會話數據的工作,但數據不被存儲在數據庫中的PHP的形式,會話數據不會被存儲
的login.php
<h2>Welcome</h2>
<form action = "Customer.php" method = "POST">
Customer Name:<input type = "text" name="customerName">
<input type = "submit" name = "submit">
</form>
Customer.php
<?php
session_start();
#include("Connection.php);
if (isset($_POST['submit'])) {
$name = $_POST['customerName'];
$_SESSION['user'] = $name;
}
if (isset($_SESSION['user']))
{
echo "Hello {$_SESSION['user']}, welcome to starbucks!";
}
else
{
echo "walang tao";
$sql="INSERT INTO `customer`.`people` ('ID', `NAME`) VALUES ('','$name')";
mysql_query($sql);
?>
<a href = "logout.php">Logout</a>
和logout.php
<?php
session_start();
session_destroy();
?>
<a href = "index.php">Click me to return to login </a>
請告訴我什麼是錯的
你也許應該刪除的#include#(「Connection.php)什麼; –
對查詢進行一些基本的調試。 – 2011-08-31 03:35:23
當從會話中檢索數據時,將數據保存到mysql與在代碼中指定的字符串文字是否有區別? – zerkms