[PEAR Newbie] PEAR problems

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

 



Hi all,

I have been developing in PHP/Interbase for about 2 years, and have just
started a new PHP aplication.

I wanted to use PEAR's DB abstraction, but am running into (big) problems. I
am sure I am doing something really stupid, but let's try anyway

External .inc.php file containing the following:

require_once("DB.php");
  Function Connect_DB() {
    $dbname="c:\www\support\database\support.gdb";
    $dbuser="SYSDBA";
    $dbpass="masterkey";
    $dbhost="localhost";
    $db=DB::connect( "ibase://$dbuser:$dbpass@$dbhost/$dbname" );
    return $db;
  }
  Function Disconnect_DB($db) {
    $db->disconnect();
  }

I include this file, and then have the following code:


 $db=Connect_DB();
  $sql = 'SELECT NAME, DESCRIPTION FROM MENUITEM';
  $demoResult = $db->query($sql);
  if (DB::isError($demoResult)) {
    die ($demoResult->getMessage());
  }
  $count = 0;
  $demoResult->fetchInto($row);
  if ($row = $demoResult->fetchRow()) {
    $count ++;
    echo "Line $count";
    echo $row[0] . $row[1]. "\n";
  }
  Disconnect_DB($db);

The database Seelct statement should return 2 populated rows (and does in
other app)
The problem is that this section is either totally ignored, or it returns
millions of lines with blank $row resurls (ie lines of "Line1\nLine2\n, etc)

Where am I going wrong?

Thanks in advance...

David R

-- 
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