|
|
|
PHP, MySQL +++รบกวนช่วยดูทีครับ INSERT ข้อมูลแล้วขึ้น Error++++ |
|
|
|
|
|
|
|
Code (PHP)
include "connect.php";
if($_POST['hd_Process'] == 'add')
{
$sql = "SELECT * FROM sp_stock WHERE username = '".trim($_POST['txUsername'])."' OR
name = '".trim($_POST['txName'])."'";
$result = mysql_query($sql);
$row = mysql_num_rows($result);
if($row>0)
{
echo "<script language='javascript'>alert('Register Failed');window.location='test3.php';</script>";
}
else
{
$strSQL = "INSERT INTO sp_stock ";
$strSQL .= "(name, username, password, typeAcc) ";
$strSQL .= "VALUES ";
$strSQL .= "'".trim($_POST['txName'])."', '".trim($_POST['txUsername'])."', ";
$strSQL .= "'".trim($_POST['txPassword'])."', '".trim($_POST['type'])."'";
$objQuery = mysql_query($strSQL);
if($objQuery)
{
echo "<script language='javascript'>alert('Register Completed');window.location='test3.php';</script>";
}
else
{
echo "Error Add [".$objQuery."]";
}
}
mysql_close();
}
ดู error มันก็ขึ้นมาเป็น
Error
[INSERT INTO sp_stock_users (name, username, password, typeAcc) VALUES 'AAA', 'BBB', 'CCC', 'admin']
ช่วยดูทีครับ
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2013-03-20 16:55:42 |
By :
golden014 |
View :
679 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$strSQL = "INSERT INTO sp_stock ";
$strSQL .= "(name, username, password, typeAcc) ";
$strSQL .= "VALUES ";
$strSQL .= "('".trim($_POST['txName'])."', '".trim($_POST['txUsername'])."', ";
$strSQL .= "'".trim($_POST['txPassword'])."', '".trim($_POST['type'])."')";
$objQuery = mysql_query($strSQL);
|
|
|
|
|
Date :
2013-03-20 17:08:46 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|