PHP Oracle oci_num_rows结果0 [英] PHP Oracle oci_num_rows result 0
问题描述
我对Oracle中的查询有疑问:
I have a question about query in Oracle :
问题是oci_num_rows
的结果始终为0.
The problem is, the result of oci_num_rows
is always 0.
这是我到目前为止的代码:
and here is my code so far :
$query = "SELECT IP_ADDRESS, STATUS FROM SEIAPPS_IP_ADDRESS WHERE IP_ADDRESS='$ip'";
$result = oci_parse($c1, $query);
oci_execute($result);
echo $found = oci_num_rows($result);
为确定起见,我尝试清除条件"WHERE IP_ADDRESS='$ip'"
.结果仍然是0,而我的表中有一些数据.
To make it sure, I try to clear the condition "WHERE IP_ADDRESS='$ip'"
. Still same with the result is 0 whereas in my table there are some data.
有什么建议吗?
推荐答案
此函数不返回选择的行数!对于SELECT statements
,此函数将返回使用oci_fetch*()
函数提取到缓冲区的行数.
This function does not return number of rows selected! For SELECT statements
this function will return the number of rows, that were fetched to the buffer with oci_fetch*()
functions.
尝试此操作以检查您的连接凭据是否正确.
Try this to check either your the credentials of your connection are correct or not.
<?php
$conn = oci_connect("hr", "welcome", "localhost/XE");
if (!$conn) {
$e = oci_error(); // For oci_connect errors do not pass a handle
trigger_error(htmlentities($e['message']), E_USER_ERROR);
}
?>
这篇关于PHP Oracle oci_num_rows结果0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!