ID:               32053
 Updated by:       [EMAIL PROTECTED]
 Reported By:      steven dot harrison3 at ntlworld dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         InterBase related
 Operating System: windows 2000 pro
 PHP Version:      4.3.9
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip




Previous Comments:
------------------------------------------------------------------------

[2005-02-21 15:47:50] steven dot harrison3 at ntlworld dot com

Description:
------------
I use a number of if statements to select an SQL string (in this case
to execute a stored procedure in a firebird database)to go in a $query
variable.
 When the string is created and ran as a query the following is kicked
out onto the screen:
ibase_query(): message length error(encountered 0, expected 7346) in
....

a typical sql string generated may be:
EXECUTE PROCEDURE SEARCH_ALL_PARAM('Teesside','business
planning','Middlesbrough','the'); 

The parameters are taken from 4 fields on a search web page. 

Reproduce code:
---------------
//Stored procedures used:
//SEARCH_NO_PARAM  - where all the search boxes have 'any' and keyword
''
if ($provider == "any" && $level == "any" && $location == "any" &&
$keyword == "")
{
$query = "EXECUTE PROCEDURE SEARCH_NO_PARAM;";
}
//SEARCH_ALL_PARAM - where all the search boxes have information.
if ($provider != "any" && $level != "any" && $location != "any" &&
$keyword != "")
{
$query = "EXECUTE PROCEDURE
SEARCH_ALL_PARAM('".$provider."','".$level."','".$location."','".$keyword."');";

}
// ### some $query removed to keep things brief. ###
?>
      <div align="center"><font size="+1"><strong>Queries and Reports
about the
        courses :</strong> </font> </div>
      <p align="center">

        <input name="submit" type="submit" value="back and change
search">
        <input name="button2" type="button"
onClick="window.location.replace('Query.php')" value="new search">
        <input name="button2" type="button"
onClick="window.location.replace('information_syllabus.php')"
value="main menu">
      </p>
      </form>
      <div align="center">
        <table width="100%" border="1">
          <tr bgcolor="#e0ffe0">
            <td>Course Title</td>
            <td bgcolor="#e0ffe0">Location</td>
            <td>Entry requirements</td>
          </tr>
          <?

                                        $result = ibase_query($db, $query);
                                                while ($row = 
ibase_fetch_object($result)) {?>
          <tr bgcolor="#f0fffe">
            <td><a href="coursedetail.php?courseid=<? echo
$row->ENTRYID;?>"><? echo $row->COURSETITLE;?></a></td>
            <td bgcolor="#f0fffe">
              <?
                                                if ($location=="any"){
                                                        $query2 = "SELECT * 
FROM TBL_MODULE_DELIVERY Where
ENTRYID='".$row->ENTRYID."'";
                                                } else {
                                                        $query2 = "SELECT * 
FROM TBL_MODULE_DELIVERY Where
ENTRYID='".$row->ENTRYID."' AND DELIVERYTOWN='".$location."'";
                                        }
                                                echo "University provider : ";
                                                if (isset 
($row->PROVIDERINSTITUTION) &&
$row->PROVIDERINSTITUTION!="") {echo $row->PROVIDERINSTITUTION;}else{
echo " - ";}
                                                echo "<BR> Delivery Town of 
Location(s): ";
                                                $result2 = ibase_query($db, 
$query2);
                                                while ($row2 = 
ibase_fetch_object($result2)) {
                                                        if (isset 
($row2->DELIVERYTOWN) && $row2->DELIVERYTOWN!=""){
                                                                echo 
$row2->DELIVERYTOWN." - ";
                                                        } else {
                                                                echo " - ";
                                                        }
                                                } ?>

Expected result:
----------------
return a result set from a search of courses in a firebird database.

Actual result:
--------------
$query echoed to screen to see if search string right:
EXECUTE PROCEDURE SEARCH_ALL_PARAM('Teesside','business
planning','Middlesbrough','the');

Then the warning message:
Warning: ibase_query(): message length error (encountered 0, expected
7346) in c:\program files\apache
group\apache\htdocs\e_prospectus\results.php on line 252

Warning: ibase_fetch_object(): supplied argument is not a valid
InterBase result resource in c:\program files\apache
group\apache\htdocs\e_prospectus\results.php on line 253



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32053&edit=1

Reply via email to