pg_query & $result re-fill

From: Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch>
To: pgsql-general(at)postgresql(dot)org
Subject: pg_query & $result re-fill
Date: 2008-06-10 15:33:35
Message-ID: F295C5F7-4201-4B25-9479-A9F6B6AE9462@grid.unep.ch
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi there,

I used to pass a the $result of a pg_query to a function which detects
min, max etc.

Now, I inserted before that another query which first queries a set of
parameters for the selected regions. Only if these parameters are
fulfilled for each of the regions, the values of the above query shall
be analyzed. Otherwise, they should be set to "NULL".

Now, as I am sending the ($result) to the function, I wonder if I can
change the values within the $result; or create a new $result based on
a couple of PHP-IFs?

Here is how it looks like:

Here is a query to retrieve the values for the selected regions and a
couple of years:

$result = pg_query("....");

The "result" looks like this:

| 1999 | 2000 | 2001 ....
A | 23 | 24 | 23
B | 12 | 15 | 18
C ....

Here is a query which load a couple of parameters:

$result_params = pg_query("....");

Here I would like to check:

IF param1 < 75 THEN region-in-$result-should-be-set-to-NULL

This is the call to the function:

$values = $h -> getValues($result, $selectedYear);

So, the question is again: Can I change values within the $result? I
have no idea how the array (?) actually looks like...

Thanks for any suggestion,

Stef

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tatsuo Ishii 2008-06-10 16:56:31 Re: [ANNOUNCE] PostgreSQL Software Catalogue
Previous Message Richard Huxton 2008-06-10 15:13:46 Re: encoding confusion