ID: 10660
Updated by: derick
Reported By: [EMAIL PROTECTED]
Status: Closed
Bug Type: OCI8 related
Operating system: 
PHP Version: 4.0.4pl1
Assigned To: 
Comments:

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

Previous Comments:
---------------------------------------------------------------------------

[2001-05-04 10:24:06] [EMAIL PROTECTED]
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-04 03:54:06] [EMAIL PROTECTED]
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


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to