pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lynna Landstreet <lynna@gallery44.org>
To: pgsql-php@postgresql.org
Subject: Resultset/array issues
Date: Fri, 01 Aug 2003 20:14:54 -0400
Message-ID: <BB507ABE.893%lynna@gallery44.org> (raw)

Hello all,

I've spent the last several hours poring through the PHP manual trying to
figure out how to do something for two pages in the site I'm working on.
Word of warning, I'm not terribly experienced yet with any of this, so these
questions may seem really dumb to a more experienced person...

What I need to do is, first - for a given artist whose ID number is passed
through the page URL, query a join table that links the artists with
keywords describing their work to get all the rows with that artist ID, then
query the keywords table to get the keywords corresponding with the keyword
IDs found in the join table query.

So that's the first problem: while it sounded straightforward when I first
thought of it, I've realized I have no idea how to do a select based on
looking for any values found in a preexisting resultset, rather than on just
looking for one value. I tried using but that just got me an error message
saying: "ERROR: pg_atoi: error in "Resource id #3": can't parse "Resource id
#3"" I could go through the keyword_id resultset row by row and look for
each one in a for statement, but then the results of each query would be a
separate resultset and that wouldn't be very useful. If I just wanted to
print each keyword on one line that would be fine, but I need to do a bit
more with them, as I'll get to in part 2. So I need to learn how to bring up
all the rows in the keywords table whose ids were found in the previous
query I did in the join table. That's thing one.

Thing two is that once I have all the data I need, I need to print it off
sorted by category - not just ordered by category, that would be easy, but
with each category as a subhead and then the keywords in that category
listed beneath it. So for that, once I've got all the keyword and category
data in a resultset, I need to extract the category values out into an
array. But all the functions I can find that do things like that are
designed to extract a row, not a column. Does anyone know if there's a way
of doing this?

BTW, just to make things more complicated, my stupid web host is still
running PHP 4.1.2 (and PostgreSQL 7.2.1)! So I don't have access to the
pg_fetch_all() function that would turn a resultset into a multidimensional
array and thus probably make it easier to work with... :-(

Any assistance would be *very* much appreciated!

Thank you,

Lynna
-- 
Resource Centre Database Coordinator
Gallery 44
www.gallery44.org




view thread (3+ messages)  latest in thread

Message-ID: <BB507ABE.893%lynna@gallery44.org>
Permalink:  ../BB507ABE.893%25lynna@gallery44.org/
Also on:    postgresql.org/message-id/BB507ABE.893%lynna@gallery44.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: lynna@gallery44.org
  Subject: Re: Resultset/array issues
  In-Reply-To: <BB507ABE.893%lynna@gallery44.org>
  References: <BB507ABE.893%lynna@gallery44.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox