Skip to main content
Inspiring
April 2, 2007
Answered

Can you use a php variable to filter a recordset?

  • April 2, 2007
  • 2 replies
  • 375 views
I've got a table of 'events', which have a description and more importantly for this a month ID number. (1-12 for the months of the year, when the event takes place) .

I've used php's date function on a page to fund out numerically what month it is now $thismonth = date("n");

i want to filter my recordset by only bringing up events that take place during the current month so where event_month = $thismonth

IS this possible? It seems like it should be easy to do but I can't get it to work.

Thanks in advance

Dave
This topic has been closed for replies.
Correct answer Newsgroup_User
jnkjnkjnkjnkjn wrote:
> i want to filter my recordset by only bringing up events that take place
> during the current month so where event_month = $thismonth
>
> IS this possible? It seems like it should be easy to do but I can't get it to
> work.

Yes, it's very easy, but you need to do a little hand-coding. In the
Advanced recordset dialog box set the end of the SQL query to WHERE
event_month = 1. When you have saved the recordset, change the SQL to
WHERE event_month = $thismonth.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/

2 replies

Inspiring
April 3, 2007
brilliant, thanks
Newsgroup_UserCorrect answer
Inspiring
April 2, 2007
jnkjnkjnkjnkjn wrote:
> i want to filter my recordset by only bringing up events that take place
> during the current month so where event_month = $thismonth
>
> IS this possible? It seems like it should be easy to do but I can't get it to
> work.

Yes, it's very easy, but you need to do a little hand-coding. In the
Advanced recordset dialog box set the end of the SQL query to WHERE
event_month = 1. When you have saved the recordset, change the SQL to
WHERE event_month = $thismonth.

--
David Powers, Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/