Re: No resultset with ocibindbyname

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:

  <?php

  $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);
	  @oci_execute($s);
  }

  $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));
  var_dump(oci_execute($cur));

  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"
  bool(true)
  bool(true)
  <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.)

Chris

--
Christopher Jones, Oracle
Email: christopher.jones@xxxxxxxxxx    Tel:  +1 650 506 8630
Blog:  http://blogs.oracle.com/opal/   Free PHP Book: http://tinyurl.com/f8jad

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux