|
|
|
เปิด เว็บมาแล้วมันบันทึกลง ฐานข้อม฿ลเองนะครับ อยากแก้ส่วนนี้ทำยังงัยครับมีโค๊ตครับ |
|
|
|
|
|
|
|
<?php require_once('Connections/project.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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;
}
}
@session_start();
if($_SESSION['UserID'] == "")
{
echo "Please Login!";
exit();
}
mysql_connect("localhost","root","root");
mysql_select_db("project");
$strSQL = "SELECT * FROM member WHERE UserID = '".$_SESSION['UserID']."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
?>
<?php
$strSQL = "INSERT INTO scorep (score1,score2,score3,score4,score5,score6,score7,score8,text1,text2,text3,text4,text5,text6,text7,text8) VALUES ('".$_POST["score1"]."','".$_POST["score2"]."','".$_POST["score3"]."','".$_POST["score4"]."','".$_POST["score5"]."','".$_POST["score6"]."','".$_POST["score7"]."','".$_POST["score8"]."','".$_POST["txt1"]."','".$_POST["txt2"]."','".$_POST["txt3"]."','".$_POST["txt4"]."','".$_POST["txt5"]."','".$_POST["txt6"]."','".$_POST["txt7"]."','".$_POST["txt8"]."')";
$objQuery = mysql_query($strSQL);
mysql_close();
?>
Tag : PHP
|
|
|
|
|
|
Date :
2015-05-10 18:36:49 |
By :
Saharatza |
View :
590 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ก็เช็คก่อนครับมีการส่งค่ามาเพื่อจัดเก็บหรือไม่?
Code (PHP)
<?php
if(!empty($_POST)){
$strSQL = "INSERT INTO scorep (score1,score2,score3,score4,score5,score6,score7,score8,text1,text2,text3,text4,text5,text6,text7,text8) VALUES ('".$_POST["score1"]."','".$_POST["score2"]."','".$_POST["score3"]."','".$_POST["score4"]."','".$_POST["score5"]."','".$_POST["score6"]."','".$_POST["score7"]."','".$_POST["score8"]."','".$_POST["txt1"]."','".$_POST["txt2"]."','".$_POST["txt3"]."','".$_POST["txt4"]."','".$_POST["txt5"]."','".$_POST["txt6"]."','".$_POST["txt7"]."','".$_POST["txt8"]."')";
$objQuery = mysql_query($strSQL);
mysql_close();
}
?>
|
|
|
|
|
Date :
2015-05-10 19:15:04 |
By :
arm8957 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|