我有一个Insert系统,用户填写几个字段,这些字段由PHP脚本捕获,然后插入到数据库中。
首先,它似乎很好,因为它插入记录,但是当我检查结果以确保它实际进入时,$result
返回false,这意味着页面没有重定向,我错过了什么?
$Prefix = $_POST['Prefix'];
$Clients = $_POST['Clients'];
$SiteName = $_POST['SiteName'];
$EndUserName = $_POST['EndUser'];
$RateType = $_POST['RateType'];
$Description = $_POST['Description'];
$QuoteStateID = '1';
$Revision = '1';
$Number = '-1';
$CreateDate = date("Y-m-d");
$result = sqlsrv_query($conn, "Insert Into Quotations (QPrefix, QClientName, QEndUserSite, QEndUserName, RateTypeID, QDescription, QuoteStateID, QRevision, QNumber, QCreateDate, QCreateUser)
Values ('$Prefix','$Clients','$SiteName','$EndUserName','$RateType','$Description', '$QuoteStateID','$Revision','$Number','$CreateDate','$CreateUser')");
echo $CreateUser.'</br>'.$Prefix.'</br>'.$Clients.'</br>'.$SiteName.'</br>'.$EndUserName.'</br>'.$RateType.'</br>'.$Description.'</br>'.$QuoteStateID.'</br>'.$Revision.'</br>'.$Number.'</br>'.$CreateDate;
if($result)
{
echo "record added successfully";
redirect();
}
elseif(($errors = sqlsrv_errors()) != null)
{
foreach( $errors as $error)
{
echo "SQLSTATE: ".$error[ 'SQLSTATE']."\n";
echo "code: ".$error[ 'code']."\n";
echo "message: ".$error[ 'message']."\n";
}
}
else{
echo "nope";
}
我的错误检查elseif
抛出:
SQLSTATE:01000代码:14243消息:[Microsoft] [用于SQL Server的ODBC驱动程序11] [SQL Server]作业'SSISUpdateExcelQuotation'已成功启动
提前致谢。