「Oracle+PHP」開発–配列パラメータを使ってデータベースを挿入する

サンプルコード:
$Oracle_conn=oci_connect(“toyoU","!kanu&","handb");
$query="insert into ctnusers(ctnuserno,ename) values(:ctnuserno,:ename)"; $statement=oci_parse($Oracle_conn,$query);
$data=array(
1981=>"a",
1982=>"b",
1983=>"c");
oci_bind_by_name($statement,":ctnuserno",$ctnuserno,26);
oci_bind_by_name($statement,":ename",$ename,26);
foreach ($data as $ctnuserno => $ename) {
if(oci_execute($statement)){
echo “データ挿入成功"."
“;
}
}
oci_free_statement($statement);
oci_close($Oracle_conn);

PHP

Posted by arkgame