Forum Moderators: coopster

Message Too Old, No Replies

Filtering from a date to a date

Filtering a small feed from a dato to a date

         

allyse

12:23 am on Jun 9, 2003 (gmt 0)

10+ Year Member



Hi!

I'm a newbie, and dont know if this is possibile:

I use this liddle code for feeding my articles:
************
if($ingresser =
hentIngresser($nettstedid,37,$sprakid,$offsetannet,$antal1ingress))
listIngresser1($ingresser);
*************

Anyone know how I can filter / limit the feed between two dates. eg from 2003 01/06 - 2003 31/07

The array from the articles are made so this should be easy.. or?

The array:

***************
(
[0] => ingress Object
(
[artikkelid] => 241
[nettstedid] => 11
[gyldig] => 1
[overskrift] => motorsport formel1
[artikkellink] => art.php?artikkelid=241
[forfatternavn] => Aleksander Lyse
[forfatterlink] => [site.com...]
[ingress] => Formel1
[publisertLang] => 20030530135301
[publisert] => 2003 30/05
[bilde] =>
[artikkeltypeid] => 38
)

***********

Hope somebody can help me!

Regards,
A. Lyse

[edited by: jatar_k at 2:42 am (utc) on June 9, 2003]
[edit reason] no urls thanks [/edit]

jatar_k

6:49 pm on Jun 9, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If it is all in an array and sorted by date you could start/stop the output as you loop through the array.

if ($array[$rowcount][publisert] < $minimumdate) break;

or something to that effect. The method would work but I am not sure how efficient it will be. The implementation would also not be quite as simple as above and will depend on how you are handling the data.

dingman

8:59 pm on Jun 9, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm guessing that you getting these arrays from a database query, based on the mention of 'ingress object'. If that's right, couldn't you just add a WHERE clause to the query, EG,

select $column_list from $table_name where $other_cinditions AND (publisert > $early_date AND publisert < $late_date);

Some databases also support a 'BETWEEN' construct that would save you the trouble of writing out two data comparisons. I've never used Ingress, so I don't know if it is among them.