Resultset/array issues

From: Lynna Landstreet <lynna(at)gallery44(dot)org>
To: <pgsql-php(at)postgresql(dot)org>
Subject: Resultset/array issues
Date: 2003-08-02 00:14:54
Message-ID: BB507ABE.893%lynna@gallery44.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

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

Responses

Browse pgsql-php by date

  From Date Subject
Next Message bruce 2003-08-02 00:27:46 Re: Resultset/array issues
Previous Message David Busby 2003-07-30 17:29:21 Re: RedirectING (asp) by PHP?