#1211 [Bgs]: Site docs for Db:tableInfo error
| From: | js at nexista dot com | Date: | Tue, 20 Apr 2004 19:26:55 +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-3666@lists.php.net to get a copy of this message | ||
ID: 1211
User updated by: js at nexista dot com
Reported By: js at nexista dot com
Status: Bogus
Bug Type: Documentation
PHP Version: Irrelevant
Assigned To: danielc
New Comment:
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
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
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