The UPDATE query is working fine in oracle, but running the program it doesnt update table. help me please.

<?php
$conn = oci_connect('test', 'test123', 'localhost/XE');
  if ( ! $conn ) 
  {
    echo "Unable to connect: " . var_dump( oci_error() );
    die();
  }
  else {
    echo "Connected sucessfully.<br /><br />\n";
  }

example_update($conn);


function example_update ($conn) 
{

// Parse an update statement containing bind variables.
$stmt = oci_parse($conn, "UPDATE timedata SET READ_FLAG = 'U' WHERE READ_FLAG = 'X'");

  // Execute the completed statement.
oci_execute($stmt, OCI_COMMIT_ON_SUCCESS);
oci_commit($conn);
oci_free_statement($stmt);
echo "Employee updated sucessfully.<br />\n";
  }
?>

Thanks.

    When posting PHP code, please use the board's [noparse]

    ..

    [/noparse] bbcode tags as they make your code much easier to read and analyze.

    As for your issue, note that [man]oci_parse/man, [man]oci_execute/man, and [man]oci_commit/man will inform you when an error occurs, yet you never check for this when calling any of the three functions. Additionally, do you have the PHP directives error_reporting set to E_ALL and display_errors (or log_errors) set to On?

      bradgrafelman;11031847 wrote:

      When posting PHP code, please use the board's [noparse]

      ..

      [/noparse] bbcode tags as they make your code much easier to read and analyze.

      As for your issue, note that [man]oci_parse/man, [man]oci_execute/man, and [man]oci_commit/man will inform you when an error occurs, yet you never check for this when calling any of the three functions. Additionally, do you have the PHP directives error_reporting set to E_ALL and display_errors (or log_errors) set to On?

      I used..

      error_reporting(E_ERROR);
      ini_set("display_errors", 1);
      ini_set("memory_limit", "256M");
      ini_set('max_execution_time', 0);
      set_time_limit(0);

      but how to check for errors in oci_parse()...?

      Thanks

        lalith.max wrote:

        but how to check for errors in oci_parse()...?

        [man]oci_parse[/man]

        Return Values

        Returns a statement handle on success, or FALSE on error.

        And if there is an error, [man]oci_error[/man] can be used.

          Weedpacket;11031947 wrote:

          And if there is an error, [man]oci_error[/man] can be used.

          Thank you very much.....

            Write a Reply...