#1211 [Bgs]: Site docs for Db:tableInfo error
| From: | danielc at analysisandsolutions dot com | Date: | Tue, 20 Apr 2004 19:50:11 +0000 |
| Subject: | #1211 [Bgs]: Site docs for Db:tableInfo error | ||
| References: | 1 | Groups: | php.pear.doc |
| Request: | Send a blank email to pear-doc+get-3674@lists.php.net to get a copy of this message | ||
ID: 1211
Updated by: danielc@analysisandsolutions.com
Reported By: js at nexista dot com
Status: Bogus
Bug Type: Documentation
PHP Version: Irrelevant
Assigned To: danielc
New Comment:
Yes, I get both arrays.
From the way you're describing the version numbers, there is a very
good likelyhood that your PEAR DB installation, and perhaps PEAR
itself, are wacked out. Blow away your old installation and start
fresh: http://pear.php.net/manual/en/installation.php
If your averse to that, set up a test bed from CVS and run the test
suite, and our test script, using that. Instructions are found here:
http://cvs.php.net/co.php/pear/DB/doc/TESTERS
Perhaps you're not connecting to the database or the queries are
failing. After the connect statement, put this:
if (DB::isError($db)) {
die($db->getMessage());
}
$db->setErrorHandling(PEAR_ERROR_DIE);
Previous Comments:
------------------------------------------------------------------------
[2004-04-20 15:26:54] js at nexista dot com
I get 2 empty arrays. With older DB (v 1.1) I get an empty
array on first dump and correct output on second. To be
sure I went and redownloaded the latest DB (1.58) and
latest PEAR (1.80)
Here is my phpinfo() dump:
http://ravenheartcoffee.com/php.html
Do you get output on both array dumps?
Joshua
------------------------------------------------------------------------
[2004-04-20 09:40:08] danielc at analysisandsolutions dot com
The following example works for me:
<?php
$db =& DB::connect('mysql://root:@localhost/dbname');
$db->query('CREATE TABLE blah (a integer)');
$db->query('INSERT INTO blah VALUES (5)');
$res =& $db->query('SELECT a FROM blah');
print_r($db->tableInfo($res));
print_r($res->tableInfo());
$db->query('DROP TABLE blah');
?>
Please copy and paste it into a stand alone script. What happens?
------------------------------------------------------------------------
[2004-04-20 01:00:00] js at nexista dot com
Small correction in what I said. That code never worked
but in older version I used $res->tableInfo() as you've
probably figured out I meant.
Joshua
------------------------------------------------------------------------
[2004-04-20 00:56:56] js at nexista dot com
Huh. I have mysql, php 4.3x, latest DB and no it doesn't
work. It worked before so mysql is not an issue.
Code:
include('pear/DB.php');
$db =& DB::connect('mysql://root:@localhost/dbname');
$res =& $db->query('SELECT * FROM clients');
$row =& $res->fetchRow();
$info = $db->tableInfo($res);
print_r($info);
prints zilch. It works if I use an older version of DB and
I can print the table info as:
$info = $db->tableInfo('clients');
Are you telling me that you can get this to work on mysql
with the RESULT object????? I'm checking once more before
I file this as a bug. I don't believe I have misunderstood
the syntax.
Thanks for your time
Joshua
------------------------------------------------------------------------
[2004-04-15 03:41:30] danielc at analysisandsolutions dot com
I pasted the example into my test script and it worked flawlessly.
Note, not all DBMS's support getting info from query results. If you
need further help, the pear-general mailing list is the best resource.
Thanks.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://pear.php.net/bugs/bug.php?id=1211
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=1211&edit=1