【发布时间】:2016-03-11 15:28:34
【问题描述】:
我正在为我的项目编写此代码,但我似乎无法将查询的值放入 $currentRow。保存到变量 $currentrow 中的所有内容都是 22,这是数据库中的行数。我想访问所有查询结果。请帮忙。这是代码。
public function getBSIConfig(){
$conn = oci_connect("472proj","system","//localhost/XE");
$sql = oci_parse($conn,"SELECT conf_id, conf_key, conf_value FROM bsi_configure");
oci_execute($sql);
echo "0";
while($currentRow = oci_fetch_all($sql,$res)){
echo "1.5";
echo $currentRow;
if($currentRow["conf_key"]){
echo "1";
if($currentRow["conf_value"]){
$this->config[trim($currentRow["conf_key"])] = trim($currentRow["conf_value"]);
echo "2";
}else{
$this->config[trim($currentRow["conf_key"])] = false;
echo "3";
}
}
}
}
而且输出只有:
0
1.5
22
【问题讨论】:
-
我从未使用过
oci_fetch_all,但fetch_all不会给你一个包含所有行的数组吗?所以我认为你会在分配数组后foreach;例如没有while。
标签: php arrays oracle loops if-statement