Bug #10660 Updated: OCIBindByName
| From: | thies@php.net | Date: | Fri, 04 May 2001 14:24:07 +0000 |
| Subject: | Bug #10660 Updated: OCIBindByName | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-53828@lists.php.net to get a copy of this message | ||
ID: 10660
Updated by: thies
Reported By: ajmer.phull@aah.co.uk
Old-Status: Open
Status: Closed
Bug Type: OCI8 related
PHP Version: 4.0.4pl1
Assigned To:
Comments:
create table test (a char);
<?
$db = OCILogon("scott","tiger");
$stmt = OCIParse($db,"insert into test values (:a)");
OCIBindByName($stmt,":a",$a,1);
$a = "h";
OCIExecute($stmt);
?>
works just great for me.
make sure you don't try to load more into a field than in room for!
Previous Comments:
---------------------------------------------------------------------------
[2001-05-04 03:54:06] ajmer.phull@aah.co.uk
SERVER: IBM AIX v4.3.3
PHP v4.0.4pl1
APACHE v1.3.19
Oracle 8i Enterprise release 8.1.7.0.0
CLIENT: DELL Intel P2
Windows NT 4.0 SP6.0a
I have created a function to update fields on the database using textboxes.
The sql statement contains parameters that obviously require binding.
I have succussfully updated several tables and fields, but whenever the field type is CHAR() then
the update does not occur and NO errors are generated.
I have performed the following to try and narrow down the problem:
Removed every parameter from the sql statement and hardcoded values, (no need to perform a bind) and
this updated succussfully.
Replaced a single parameter and performed a bind for that parameter and this updated succussfully,
but only where the field being updated was NOT a CHAR()
Here is the function stripped down:
function Save_Details($conn)
{
$sql=" update staticdata2 set
description = :td
where tableref2 = :tr
and upper(tablecode2) = :tc ";
if (!($qry = @OCIParse($conn, $sql)))
{
$err = OCIError($conn);
OCILogoff($conn);
$m_msg="<span class=error>" . __LINE__ . ": Error " .
$err["message"] . ".</span>";
return;
}
echo("<!-- $code $description $tableref -->n");
OCIBindByName($qry, ":tc", &$code, 3);
OCIBindByName($qry, ":td", &$description, 41);
OCIBindByName($qry, ":tr", &$tableref, 4);
if (!@OCIExecute($qry))
{
$err = OCIError($qry);
OCIFreeStatement($qry);
OCILogoff($conn);
$m_msg="<span class=error>" . __LINE__ . ": Error " .
$err["message"] . ".</span>";
return;
}
OCIFreeStatement($qry);
}
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10660&edit=2