gpt4 book ai didi

PHP ORA-01745 : invalid host/bind variable name Warning

转载 作者:可可西里 更新时间:2023-11-01 12:29:04 26 4
gpt4 key购买 nike

01745:运行滚动代码时出现无效主机/绑定(bind)变量名称警告。我不确定为什么会这样,请帮忙!我觉得我的绑定(bind)一定有问题,但我看不出有什么问题。我的 $Start 和 $End 变量看起来像 DD-MM-YY。我在下面列出了 PHP 代码。谢谢!

PHP:

<?php
$year_Echo = '2013';
$yearTruncation = substr($year_Echo, 2);
$yearTruncationMinusOne = $yearTruncation-1;
$Start = ('1-OCT-'.$yearTruncationMinusOne);
$End = ('30-SEP-'.$yearTruncation);
echo "Start = ".$Start." End = ".$End." Year Truncation Minus One = ".$yearTruncationMinusOne."<br>";

/*** connect or WFO DB ***/
$db = oci_connect('query','pw','server:1521/view');
if (!$db){
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$query = "SELECT * FROM db.cooldb WHERE (STATUS = 'ACTIVE' OR STATUS = 'CLOSED') AND NUMBER <> ' '
AND AMENDMENT_DATE_CREATED
BETWEEN :start AND :end
ORDER BY AMENDMENT_DATE_CREATED DESC";

$runQuery = oci_parse($db, $query);
oci_bind_by_name($runQuery, ":start", $Start);
oci_bind_by_name($runQuery, ":end", $End);
oci_execute($runQuery);

while($row = oci_fetch_array($runQuery, OCI_ASSOC+OCI_RETURN_NULLS))
{
echo $row['AMENDMENT_DATE_CREATED']." ".$row['TITLE']."<br>";
}
?>

错误:

Warning:
oci_execute() [function.oci-execute]: ORA-01745: invalid host/bind variable name

最佳答案

问题是您正在使用保留的 oracle 字(即我认为“:end”是罪魁祸首)作为绑定(bind)变量名称,这是不允许的。

尝试将其更改为“:finish”或类似的,它应该可以工作。

关于PHP ORA-01745 : invalid host/bind variable name Warning,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28464732/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com