|
|
|
ขอถามเรื่อง การแสดงวันที่ ทำแล้วมันไม่แสดง รบกวนของคำแนะนำค่ะ |
|
|
|
|
|
|
|
Code (PHP)
<?php require_once('Connections/dbstudent.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO board_quiz (title, message, name, `date`) VALUES (%s, %s, %s, %s)",
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['meage'], "text"),
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['date'], "date"));
mysql_select_db($database_dbstudent, $dbstudent);
$Result1 = mysql_query($insertSQL, $dbstudent) or die(mysql_error());
$insertGoTo = "webboard.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?><!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=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
<p>ตั้งกระทู้ใหม่ </p>
<p>ชื่อกระทู้
<label>
<input type="text" name="title" id="title" />
</label>
</p>
<p>รายละเอียด
<label>
<textarea name="meage" cols="45" rows="5" id="meage"></textarea>
</label>
</p>
<p>ผู้ตั้ง
<label>
<input type="text" name="name" id="name" />
</label>
<input name="date" type="hidden" id="date" value="(<?=date("Y-m-d H:i");?>) " />
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="ตั้งกระทู้" />
</label>
</p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<input type="hidden" name="MM_insert" value="form1" />
</form>
</body>
</html>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2012-11-11 12:48:48 |
By :
ale |
View :
876 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ใน db มันมีข้อมูลแบบใหนครับ cap มาให้ดูหน่อยครับว่ามีข้อมูลหรือเปล่า
|
|
|
|
|
Date :
2012-11-11 20:19:55 |
By :
deawx |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|