Re: Resultset/array issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



hey...

to give a better understanding of what you're trying to do...

could you provide some sample tbl/row data, as well as some of the psuedo
code you're dealing with...

thanks

bruce
bedouglas@xxxxxxxxxxxxx


-----Original Message-----
From: pgsql-php-owner@xxxxxxxxxxxxxx
[mailto:pgsql-php-owner@xxxxxxxxxxxxxx]On Behalf Of Lynna Landstreet
Sent: Friday, August 01, 2003 5:15 PM
To: pgsql-php@xxxxxxxxxxxxxx
Subject: [PHP] Resultset/array issues


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


---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
    (send "unregister YourEmailAddressHere" to majordomo@xxxxxxxxxxxxxx)



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux