php+oracle sql语句执行不成功的问题
我conn.php中有个exequery方法具体如下functionexequery($C,$Q){$stmt=ociparse($C,$Q);ociexecute($s...
我conn.php中有个 exequery方法具体如下
function exequery($C, $Q)
{
$stmt = ociparse($C, $Q);
ociexecute($stmt, OCI_DEFAULT);
if (!$stmt) {
PrintError("<b>SQL语句:</b> " . $Q);
//exit;
}
return $stmt;
}
在应用中查询语句
$sql="select * from user";
exequery($C, $sql);
这样就能查询成功
但是针对insert、update、delete 语句就不能成功
$sql="update user set uname='aa' where uid=1";
exequery($C, $sql);
求教。我该怎么修改 exequery方法 展开
function exequery($C, $Q)
{
$stmt = ociparse($C, $Q);
ociexecute($stmt, OCI_DEFAULT);
if (!$stmt) {
PrintError("<b>SQL语句:</b> " . $Q);
//exit;
}
return $stmt;
}
在应用中查询语句
$sql="select * from user";
exequery($C, $sql);
这样就能查询成功
但是针对insert、update、delete 语句就不能成功
$sql="update user set uname='aa' where uid=1";
exequery($C, $sql);
求教。我该怎么修改 exequery方法 展开
推荐于2016-01-09
展开全部
我是这样写的,无论我用empty还是OCIColumnIsNULL来判断,都没有执行进去
$sql = "SELECT TAX_FPDJ.DJRQ FROM TAX_FPDJ,TAX_FPDJTI WHERE TAX_FPDJTI.FPDM = '".$FapiaoDM."' AND TAX_FPDJTI.QSH <= '".$FapiaoHM."' AND TAX_FPDJTI.QSH+TAX_FPDJTI.SL*TAX_FPDJTI.ZZH >= '".$FapiaoHM."' AND TAX_FPDJ.DJXH = TAX_FPDJTI.DJXH AND TAX_FPDJ.TAXPAYERID = ".$asTaxpayerid." AND TAX_FPDJ.DJLX = '8'";
$stmt = OCIParse($conn,$sql);
$rs = OCIExecute($stmt);
while (OCIFetch($stmt)){
$asEndTime = OCIResult($stmt,1);
if (empty($asEndTime))
{$asDatetime = $asStartTime;
$tip = "没有缴销";}
else
$asDatetime = $asStartTime."至".$asEndTime;
}
OCIFreeStatement($stmt);
$sql = "SELECT TAX_FPDJ.DJRQ FROM TAX_FPDJ,TAX_FPDJTI WHERE TAX_FPDJTI.FPDM = '".$FapiaoDM."' AND TAX_FPDJTI.QSH <= '".$FapiaoHM."' AND TAX_FPDJTI.QSH+TAX_FPDJTI.SL*TAX_FPDJTI.ZZH >= '".$FapiaoHM."' AND TAX_FPDJ.DJXH = TAX_FPDJTI.DJXH AND TAX_FPDJ.TAXPAYERID = ".$asTaxpayerid." AND TAX_FPDJ.DJLX = '8'";
$stmt = OCIParse($conn,$sql);
$rs = OCIExecute($stmt);
while (OCIFetch($stmt)){
$asEndTime = OCIResult($stmt,1);
if (empty($asEndTime))
{$asDatetime = $asStartTime;
$tip = "没有缴销";}
else
$asDatetime = $asStartTime."至".$asEndTime;
}
OCIFreeStatement($stmt);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询