php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #10660 OCIBindByName
Submitted: 2001-05-04 03:54 UTC Modified: 2001-05-08 03:12 UTC
From: ajmer dot phull at aah dot co dot uk Assigned:
Status: Closed Package: OCI8 related
PHP Version: 4.0.4pl1 OS: IBM AIX v4.3.3
Private report: No CVE-ID: None
 [2001-05-04 03:54 UTC] ajmer dot phull at aah dot co dot 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);  

}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-05-04 10:24 UTC] thies@php.net
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!

 [2001-05-08 03:12 UTC] derick@php.net
User reports:
proved it was the cause of the problem by re-creating our table without CHAR
fields. Worked successfully. There must be some settings different on our
system, either with Oracle or PHP. I will have a look into this.

And:
try an UPDATE instead of an INSERT
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 10:01:26 2024 UTC