php-db | 2001011
Date: 01/11/01
- Next message: simon: "Re: [PHP-DB] Easy MySQL question"
- Previous message: Nicolas Windpassinger - Sun: "[PHP-DB] Re: [PHP] Easy MySQL question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I get the following error when I try and write to the database on only
some of the items in $res. The majority go in fine. When I enter the
ones causing an error, individually, they go in without a problem. Is
it because I'm using a loop to enter the data? Can anyone help please?
Thanks in advance,
Simon.
Error:
Warning: OCIStmtExecute: ORA-01704: string literal too long
Code:
while ( list($k, $v) = each($res) )
{
$body = $res[$k][1];
$id = $res[$k][0];
$body = preg_replace( "/'/", "''", $body );
$sql = "update story
set body = '$body'
where id = $id returning body into :body";
$stmt = OCIParse($db->conn, $sql);
$lob = OCINewDescriptor($db->conn, OCI_D_LOB);
OCIBindByName($stmt, ":body" , &$lob, -1, OCI_B_CLOB);
OCIExecute($stmt, OCI_DEFAULT);
$body = preg_replace( "/''/", "'", $body );
if ( $lob->save ("$body") )
{
echo "$id written to database<BR>\n";
}
OCICommit($db->conn);
OCIFreeStatement($stmt);
OCIFreeDesc($lob);
}
--Simon Pospisil Mail: simon.pospisil <email protected> Web Engineer Web: http://www.fastsearch.com/ Fast Web Media Ltd. Phone: +44 (0) 161 835 3444 Suite 1202, Sunlight House Quay Street Fax: +44 (0) 161 835 3488 Manchester, England M3 3JZ
Try FAST Search: http://www.alltheweb.com
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: simon: "Re: [PHP-DB] Easy MySQL question"
- Previous message: Nicolas Windpassinger - Sun: "[PHP-DB] Re: [PHP] Easy MySQL question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

