Error SQL SERVER จากการเข้ารหัส AES ครับแก้ยังไงดี
มันแจ้ง Error ว่า
"Warning: mssql_query() [function.mssql-query]: message: Unclosed quotation mark after the character string 'ฑปqJ5Kำฟb'. (severity 15) in D:\xampp\htdocs\salary\database.mssql.class\msdatabase.class.php on line 44
Warning: mssql_query() [function.mssql-query]: message: Incorrect syntax near 'ฑปqJ5Kำฟb'. (severity 15) in D:\xampp\htdocs\salary\database.mssql.class\msdatabase.class.php on line 44
Warning: mssql_query() [function.mssql-query]: Query failed in D:\xampp\htdocs\salary\database.mssql.class\msdatabase.class.php on line 44 "
จะแก้ยังดีอ่ะครับ ผมใช้การเข้ารหัสแบบ AES ไว้ด้วยครับ
Code (PHP)
<?php
session_start();
header("Content-type:text/html; charset=tis-620");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
require("../database.mssql.class/msdatabase.class.php");
require("../database.mssql.class/config.inc.php");
require("../function/function.php");
require("../function/AES.class.php");
$objdb = new MSDatabase($strHost,$strDB,$strUser,$strPassword);
$aes = new AES($_SESSION["encryp"]);
$datetime=date("Y-m-d H:i:s.000");
$userin = $_SESSION["session_empid"];
$sql_ref = "SELECT MAX(refid) AS ref FROM tbtotalsalary ";
$rec_ref = $objdb->query_first($sql_ref);
$refid = $rec_ref["ref"]+1;
$years = $_POST["years"];
$rounds = $_POST["rounds"];
$class = $_POST["class"];
$typeid = $_POST["employment"];
//echo "Percent : ".$_POST["total_percent"];
$total_percent = $aes->encrypt($_POST["total_percent"]);
$total_amount_up = $aes->encrypt($_POST["total_total"]);
$total_amount = $aes->encrypt($_POST["total_amount"]);
$total_salary = $aes->encrypt($_POST["totals"]);
$total_remain = $aes->encrypt($_POST["remain"]);
/*$total_percent = $_POST["total_percent"];
$total_amount_up = $_POST["total_total"];
$total_amount = $_POST["total_amount"];
$total_salary = $_POST["totals"];
$total_remain = $_POST["remain"];*/
$sql_totalsalary = "INSERT INTO tbtotalsalary VALUES(
'$refid','$years','$typeid','$class','$rounds'
,'$total_percent','$total_amount_up','$total_amount','$total_salary','$total_remain'
,'$datetime','$userin'
)";
echo $sql_totalsalary."<br>";
$exetotalsalary = $objdb->query($sql_totalsalary);
if ($exetotalsalary)
{
$count = $_POST["hdn"];
for ($i=1;$i<$hdn;$i++)
{
$empid = $_POST["hdnempid".$i];
$salary = $aes->encrypt($_POST["hdnamount".$i]);
$percents = $aes->encrypt($_POST["percent".$i]);
$amount = $aes->encrypt($_POST["total".$i]);
$total_amounts = $aes->encrypt($_POST["total_amount".$i]);
/*$empid = $_POST["hdnempid".$i];
$salary = $_POST["hdnamount".$i];
$percents = $_POST["percent".$i];
$amount = $_POST["total".$i];
$total_amounts = $_POST["total_amount".$i];*/
$sql_salary = "INSERT INTO tbsalary(refid,empid,years,round,salary,percents,amount,total_amount,datein,userin) VALUES(
'$refid','$empid','$years','$rounds'
,'$salary','$percents','$amount','$total_amounts'
,'$datetime','$userin'
)";
//echo $sql_salary."<br>";
$exesalary = $objdb->query($sql_salary);
}//End for
}//End exetotalsalary
?>
Tag : PHP, Ms SQL Server 2008
Date :
2018-01-23 16:31:38
By :
Clamore
View :
774
Reply :
2
ไฟล์นี้มีปัญหาหรือเปล่าครับ
database.mssql.class/msdatabase.class.php
Date :
2018-01-23 17:21:32
By :
mongkon.k
echo sql ออกมาดู
Date :
2018-01-24 06:10:48
By :
mr.v
Load balance : Server 05