[請益] 表PHP連結MYSQL 可以幫我看哪裡錯誤嗎 ?
<?
//接收html表單傳來的資訊
$Text1= $_REQUEST["Text1"];
$userid= $_REQUEST["userid"];
$Text5=$_REQUEST["Text5"];
$email= $_REQUEST["email"];
//下面這一格是多行文字的接收
$Text112=nl2br($_REQUEST["Text112"]);
//連結MySQL Server
$conn = mysql_connect("XX.XXX.XXX.XX", "OOOOOOOOOO", "ZZZZZZZZZ");
//選擇資料庫
mysql_select_db("OOOOOOOOOO", $conn);
//指定提取資料的校對字元表
mysql_query("set character set UTF-8");
//將單引號置換為雙引號
Function chgStr($data)
{
$chgStr = "'" . str_replace("'", "''", $data) . "'";
return $chgStr;
}
//將資料寫入資料庫
$sql = "Insert Into allmessage (姓名,電話,手機,電子信箱,自我介紹,日期) Values
(";
$sql = $sql . chgStr($Text1) . ",";
$sql = $sql . chgStr($userid) . ",";
$sql = $sql . chgStr($Text5) . ",";
$sql = $sql . chgStr($email) . ",";
$sql = $sql . chgStr($Text112) . ",";
$sql = $sql . date("Y-m-j H:i:s") . "')";
mysql_query($sql);
//將網頁轉向至首頁
header("Location: index.html");
?>
可以幫我檢視哪裡有誤嗎?
--
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.34.178.163
※ 文章網址: http://www.ptt.cc/bbs/PHP/M.1411627794.A.D15.html
推
09/25 15:05, , 1F
09/25 15:05, 1F
→
09/25 15:08, , 2F
09/25 15:08, 2F
→
09/25 15:08, , 3F
09/25 15:08, 3F
推
09/25 15:10, , 4F
09/25 15:10, 4F
→
09/25 15:25, , 5F
09/25 15:25, 5F
→
09/25 15:37, , 6F
09/25 15:37, 6F
推
09/25 15:44, , 7F
09/25 15:44, 7F
→
09/25 15:45, , 8F
09/25 15:45, 8F
→
09/25 15:46, , 9F
09/25 15:46, 9F
→
09/25 15:50, , 10F
09/25 15:50, 10F
→
09/25 15:51, , 11F
09/25 15:51, 11F
推
09/25 16:06, , 12F
09/25 16:06, 12F
→
09/25 16:07, , 13F
09/25 16:07, 13F
→
09/25 16:07, , 14F
09/25 16:07, 14F
→
09/25 16:08, , 15F
09/25 16:08, 15F
→
10/03 15:26, , 16F
10/03 15:26, 16F
討論串 (同標題文章)
完整討論串 (本文為第 1 之 2 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章