note 4149 modified in function.ocinewdescriptor by sixd
| From: | sixd@php.net | Date: | Thu, 08 Oct 2009 19:26:24 +0000 |
| Subject: | note 4149 modified in function.ocinewdescriptor by sixd | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-161543@lists.php.net to get a copy of this message | ||
[Editor's note: don't use '&' for parameters in bind calls in PHP 5]
The code up above is somewhat correct... here's an example of how I got a CLOB to work
<?php
function insert_adinfo($AdInfoID, $MagazineType, $Publish, $DatePost, $BodyText)
{
global $db;
// Insert record into database
$clob = OCINewDescriptor($db, OCI_D_LOB);
$stmt = OCIParse($db,"insert into tblAdInfo values ($AdInfoID,
$MagazineType, '$Publish', to_date('$DatePost', 'YYYY-MM-DD'),
EMPTY_CLOB()) returning BodyText into :the_blob");
OCIBindByName($stmt, ':the_blob', &$clob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
if($clob->save($BodyText)){
OCICommit($db);
}else{
echo "Problems: Couldn't upload Clob\n";
}
OCIFreeDescriptor($clob);
OCIFreeStatement($stmt);
}
?>
--was--
The code up above is somewhat correct... here's an example of how I got a CLOB to work
<?php
function insert_adinfo($AdInfoID, $MagazineType, $Publish, $DatePost, $BodyText)
{
global $db;
// Insert record into database
$clob = OCINewDescriptor($db, OCI_D_LOB);
$stmt = OCIParse($db,"insert into tblAdInfo values ($AdInfoID,
$MagazineType, '$Publish', to_date('$DatePost', 'YYYY-MM-DD'),
EMPTY_CLOB()) returning BodyText into :the_blob");
OCIBindByName($stmt, ':the_blob', &$clob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
if($clob->save($BodyText)){
OCICommit($db);
}else{
echo "Problems: Couldn't upload Clob\n";
}
OCIFreeDescriptor($clob);
OCIFreeStatement($stmt);
}
?>
http://php.net/manual/en/function.ocinewdescriptor.php