#1211 [Bgs]: Site docs for Db:tableInfo error
| From: | danielc at analysisandsolutions dot com | Date: | Tue, 20 Apr 2004 13:40:08 +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-3664@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:
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?
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[2004-04-14 19:12:56] js at nexista dot com
I did not have latest version. Now it doesn't work at all.
It still accepts a table name but passing a result object
returns nothing. reverting back to old version.
------------------------------------------------------------------------
[2004-04-14 15:58:26] danielc at analysisandsolutions dot com
The manual is correct for current versions of DB -- meaning including
1.6.0 and greater.
If I get a moment I'll add a note to the docs about this.
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