Manuel Schölling wrote:
Hi guys,

sorry for spamming your mailing list.

I have a strange problem with ocibindbyname():
I use this simple code to start an SQL query:

But this query doesn't give me any data record  (no error; empty resultset).

I couldn't reproduce your problem.  What does your table look like?
What version of PHP & OCI8?  What version of Oracle?

I tried this script:


  $conn = oci_connect('hr', 'hrpwd', '//localhost/XE');

  $stmtarray = array(
          "drop table projekte_generisch",
          "create table projekte_generisch (pid varchar2(40))",
          "insert into projekte_generisch (pid) values ('einepid')"

  foreach ($stmtarray as $stmt) {
          $s = oci_parse($conn, $stmt);

  $sql = "Select * from projekte_generisch where pid=:data";
  $cur = oci_parse($conn, $sql);
  var_dump($conn, $cur, $sql);

  $pid = "einepid";
  var_dump(ocibindbyname($cur, ":data", $pid));

  print '<table border="1">';
  while ($row = oci_fetch_array($cur, OCI_RETURN_NULLS)) {
      print '<tr>';
          foreach ($row as $item) {
                  print '<td>'.($item?htmlentities($item):'&nbsp;').'</td>';
          print '</tr>';
  print '</table>'


The output is:

  $ ~/php/bin/php t1.php
  resource(5) of type (oci8 connection)
  resource(9) of type (oci8 statement)
  string(48) "Select * from projekte_generisch where pid=:data"
  <table border="1"><tr><td>einepid</td><td>einepid</td></tr></table>

(The value is repeated because the array contains numerically and
associatively indexed values.)


Christopher Jones, Oracle
Email: [EMAIL PROTECTED]    Tel:  +1 650 506 8630
Blog:   Free PHP Book:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to