0

So, I haven't used firebird for that long, but i'm writing a search engine for a database we have. There is a field that required you to ask for a reason the record was changed if you edit the record for some reason. If the user fails to input this reason, I mark it in another table, to keep track of it all.

So, in my search results, I query this second table, and I'm trying to check for a non null (no one entered a reason for change) result set. However, I've tried using both ibase_query and ibase_fetch_row return results, and it doesn't work as expected.

I've been going off of the php manual, and it says they should return TRUE (for ibase_query) or FALSE (for ibase_fetch_row) if the result set has nothing.

http://php.net/manual/en/function.ibase-query.php http://php.net/manual/en/function.ibase-fetch-row.php

Here is the code for the ibase_fetch_row:

$query3 = "Select CHANGE_REASON from REASON_FOR_CHANGES where id = $id";
$result3 = ibase_query($link, $query3);

if (ibase_fetch_row($result3) != FALSE) {
   $reasonChange = "<span style='color:red'>".
       "No Reason Given. <a href='changeReason.php?id=$id'>Add Reason</a></span>";
}

And for ibase_query:

$query3 = "Select CHANGE_REASON from REASON_FOR_CHANGES where id = $id";
$result3 = ibase_query($link, $query3);

if ($result3 == TRUE) {
   $reasonChange = "<span style='color:red'>".
       "No Reason Given. <a href='changeReason.php?id=$id'>Add Reason</a></span>";
}

Anyone have any clue what I'm doing wrong? It seems like the returns from the two functions aren't as documented.

Fooldj
  • 163
  • 1
  • 14

0 Answers0