Quantcast

pg_query & $result re-fill

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

pg_query & $result re-fill

Stefan Schwarzer
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

--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pg_query & $result re-fill

Scott Marlowe-2
On Tue, Jun 10, 2008 at 9:33 AM, Stefan Schwarzer
<[hidden email]> wrote:

> Here I would like to check:
>
>        IF param1 < 75 THEN region-in-$result-should-be-set-to-NULL

Not sure I get what all you're wanting to do from your message, but
could you use a case statement in sql to do this?  Or put it in the
where clause?

--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: pg_query & $result re-fill

Stefan Schwarzer
>> Here I would like to check:
>>
>>       IF param1 < 75 THEN region-in-$result-should-be-set-to-NULL
>
> Not sure I get what all you're wanting to do from your message, but
> could you use a case statement in sql to do this?  Or put it in the
> where clause?

I knew it too be a bit complicated to explain....

Basically, it's more a PHP question, I guess. And that is if there is  
a way to "infiltrate" the $result and change values within. Something  
like
               
                        $result[2][6] = "other value";



--
Sent via pgsql-general mailing list ([hidden email])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Loading...