PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #1964

Problem running multiple queries

Details

Submitted2004-07-23 16:42 UTC
Fromarnsholt at online dot no
Assigneddanielc
StatusBogus
PackageDB
PHP Version4.3.8
OSlinux
Roadmaps(Not assigned)

Comments

[2004-07-23 16:42 UTC] arnsholt at online dot no

Description:
------------
I'm running two queries in sequence on a pgsql DB, and the second one (lines 9 & 10 of the example code) returns an unknown error. The the query is valid and runs perfectly well when pasted in the command line client or using the native PHP interface to pgsql.
Using DB-1.6.4

Reproduce code:
---------------
$group =& $admin_db->query ( "SELECT name FROM groups WHERE group_id = $_GET[item]" );

if ( DB::isError ( $group ) )
{ die ( "Error while fetching group: " . $group->getMessage () ); }

$_GET ["item"] = $user_db->quoteSmart ( $_GET ["item"] );
$members =& $user_db->query ( "SELECT b.lastname || ', ' || b.firstname || ' (' || b.signature || ')' AS name
FROM group_membership AS a, persons AS b WHERE a.group_id = $_GET[item] AND a.person_id = b.person_id" );
if ( DB::isError ( $members ) )
{ die ( "Couldn't fetch group members: " . $members->getMessage () ); }

Expected result:
----------------
Both queries run well, and their results are stored in $group and $members respectively.

Actual result:
--------------
The code dies on line 12 with the following message: "Couldn't fetch group members: DB Error: unknown error"

[2004-07-23 18:52 UTC] arnsholt at online dot no

Cheers. That fixed it. Turns out I'd forgotten to grant access on the second table to my cgi user. Oops.