Re: [PHP] Interbase error code = -504 Cursor unknow

2001-03-27 Thread Mauricio Junqueira


Since ibase_query returns true if the query succeeds I've tried this, but 
with the same problem with ibase_fetch_row:

  $stmt = "select count(*) from soldcars";
  if ($query= ibase_query($stmt) or die ("alert('" . ibase_errmsg() . "'); ")){
$result   = ibase_fetch_row($query);
$TOTSOLD  = $result[0];
ibase_free_result($query);}

-- 
PHP General 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]




[PHP] Interbase error code = -504 Cursor unknow

2001-03-27 Thread Mauricio Junqueira


Hello, this is my first attempt to query and print a result coming from a 
database, in this case interbase6.

I got the following error: InterBase: Dynamic SQL Error SQL error code = 
-504 Cursor unknown in maingeral.htm on line 8

Here's the code: 
 alert('" . ibase_errmsg() . 
"'); ");
 
  $stmt = "select count(*) from soldcars";
  $query= ibase_query($stmt) or die ("alert('" . ibase_errmsg() . "'); ");
  $result   = ibase_fetch_row($query);// THIS IS LINE 8
  $TOTSOLD  = $result;
  ibase_free_result($query);
 
  $stmt="select Total from monthsold";
  $query   = ibase_query($stmt) or die ("alert('" . ibase_errmsg() . "'); ");
  $result  = ibase_fetch_row($query);
  $TOTMONTH = $result[0];
  ibase_free_result($query);
 
  $stmt= "select count(*) from deal where available = 1";
  $query   = ibase_query($stmt) or die ("alert('" . ibase_errmsg() . "'); ");
  $result  = ibase_fetch_row($query);
  $TOTAVAIL= $result[0];
  ibase_free_result($query);
 
  ibase_commit();
  ibase_close();
?>

I have 3 query blocks. the result shows the contents of 2nd and 3rd block 
variable:TOTMONH and TOTAVAIL but nothing from the first block, TOTSOLD.
If I comment the first block entirely, I got the same error 
(ibase_fetch_row line) on the 2nd block and the only result that appear is 
from the 3rd block.

What I am doing wrong?


I've put this statement before the first block to see if $query was empty 
but the statement return true and the same error occured in the 
ibase_fetch_row line and the echo $query shows everytime Resource id#4

 if (isset($query)) {
  echo($query);
  $result   = ibase_fetch_row($query);
  $TOTSOLD  = $result;
  ibase_free_result($query);
  } else echo "query not set";

If just comment the following lines, everything works Please help... 
I'm getting nut !!

 alert('" . ibase_errmsg() . 
"'); ");
 
  $stmt = "select count(*) from soldcars";
  $query= ibase_query($stmt) or die ("alert('" . ibase_errmsg() . "'); ");
//  $result   = ibase_fetch_row($query);
//  $TOTSOLD  = $result[0];
//  ibase_free_result($query);
$TOTSOLD ="COMMENTED";
 
  $stmt="select Total from monthsold";
  $query   = ibase_query($stmt) or die ("alert('" . ibase_errmsg() . "'); ");
  $TOTMONTH = $result[0];
  ibase_free_result($query);
 
  $stmt= "select count(*) from deal where available = 1";
  $query   = ibase_query($stmt) or die ("alert('" . ibase_errmsg() . "'); ");
  $result  = ibase_fetch_row($query);
  $TOTAVAIL= $result[0];
  ibase_free_result($query);
 
  ibase_close();
?>


-- 
PHP General 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]