title: How to update blob image in oracle database using php?
body: <p>I want to update image(blob) in my database using PHP. I was able to insert it successfully but unable to update it. <strong>I get 'invalid LOB locator specified' error</strong>.</p>
  
  <p>This is insert query: </p>
  
  <p>$myblobid = 157;</p>
  
  <pre><code>  // Insert the BLOB from PHP's tempory upload area
  
    $lob = oci_new_descriptor($db, OCI_D_LOB);
    $stmt = oci_parse($db, 'INSERT INTO JOB_SEEKER (SEEK_ID, SEEK_PICTURE) '
           .'VALUES(:MYBLOBID, EMPTY_BLOB()) RETURNING SEEK_PICTURE INTO :BLOBDATA');
    oci_bind_by_name($stmt, ':MYBLOBID', $myblobid);
    oci_bind_by_name($stmt, ':BLOBDATA', $lob, -1, OCI_B_BLOB);
    oci_execute($stmt, OCI_DEFAULT);
  
    // The function $lob-&gt;savefile(...) reads from the uploaded file.
    // If the data was already in a PHP variable $myv, the
    // $lob-&gt;save($myv) function could be used instead.
    if ($lob-&gt;savefile($_FILES['lob_upload']['tmp_name'])) {
      oci_commit($db);
    }
    else {
      echo "Couldn't upload Blob\n";
    }
    $lob-&gt;free();
    oci_free_statement($stmt);
  </code></pre>
  
  <p>I tried update query :</p>
  
  <pre><code> $myblobid = 157;
        // Update 
        $lob = oci_new_descriptor($db, OCI_D_LOB);
        $stmt = oci_parse($db, 'UPDATE JOB_SEEKER SET SEEK_PICTURE = :BLOBDATA WHERE SEEK_ID = :MYBLOBID ');
        oci_bind_by_name($stmt, ':MYBLOBID', $myblobid);
        oci_bind_by_name($stmt, ':BLOBDATA', $lob, -1, OCI_B_BLOB);
        oci_execute($stmt, OCI_DEFAULT);
  
        // The function $lob-&gt;savefile(...) reads from the uploaded file.
        // If the data was already in a PHP variable $myv, the
        // $lob-&gt;save($myv) function could be used instead.
        if ($lob-&gt;savefile($_FILES['lob_upload']['tmp_name'])) {
          oci_commit($db);
        }
        else {
          echo "Couldn't upload Blob\n";
        }
        $lob-&gt;free();
        oci_free_statement($stmt);
  </code></pre>