「PHP+Oracle」開発–oci_bind_by_name()を使ってselect のサンプル
参考コード:
$Oracle_conn=oci_connect(“toyoUnk","!kanu&","wyhj");
$query="select * from ctnuser where job=upper(:job) and deptno=upper(:deptno)";
$statement=oci_parse($Oracle_conn,$query);
//初期化
$job="engineer";
$deptno=15;
oci_bind_by_name($statement,":job",$job);
oci_bind_by_name($statement,":deptno",$deptno);
oci_execute($statement);
oci_fetch_all($statement,$result);
foreach($result as $rows){
echo "
“;
foreach($rows as $col_values){
echo $col_values;
}
}
//解放
oci_free_statement($statement);
oci_close($Oracle_conn);