Re: Filtering using manually entered values
On Aug 10, 6:17 pm, mussond <[EMAIL PROTECTED]> wrote: > Hey, thanks for the link :) but I'm not using 1.2 :( only named params are 1.2 specific there > The project I'm evolved with uses 1.1, hence my use of query in the > 1st place. so there wasn't a findAll in 1.1 ? ;) It's not an excuse:) > What do you mean a POST action? using php or is it a cake 1.2 function > HttpSocket::post? i mean send a http post - either by submitting a form to your action with the values so you can filter by them or use ajax > Is there a way to show my dates and send them back to the controller > using 1.1? see above > Cheers, > > Dave > > On Aug 10, 2:15 am, kabturek <[EMAIL PROTECTED]> wrote: > > > Do a POST to the action when the users clicks submit in the form or > > do this with ajax if you don't want the whole page to be refreshed > > > Also why are you using query ? its only for sql that can't be handled > > by cake and your's looks pretty basic. Generally you're doing a search > > box. > > http://wiki.kabturek.info/paginating_search_results > > > > not all aplies for you cause you want to do it on the same page but > > look at the code and you'll find some usefull snippets > > > greets, > > > On Aug 10, 4:57 am, mussond <[EMAIL PROTECTED]> wrote: > > > > I'd like to filter my view based on the input from the user. The > > > thought is the user will enter a date range using input text boxes. > > > These values would be passed to the controller and an query($sql) > > > would return values I'll display in a table. > > > > I can get the query and the table to work no problem but I can't find > > > a way to get the date values from the view to the controller and thus > > > be used in the query. > > > > I've got two text inputs that contain the MIN and MAX date values from > > > the database. > > > > start: > > > > end: > > > > Also the user will filter the query by selecting a user id from a > > > select box. In my controller I set this value to the variable > > > $id_user, which is then used in the query(): > > > > $id_user = $this->data['ComUser']['id']; > > > > $this->set('data', $this->DataPoint->query("SELECT w.com_user_id, > > > count(p.id) as c FROM data_points p join des_walks w WHERE > > > p.des_walk_id = w.id AND w.com_user_id = '$id_user' AND p.date >= > > > '2006-12-09' AND p.date <= '2006-12-10' GROUP BY w.com_user_id")); > > > > So my question is how can I replace the '2006-12-09' and '2006-12-10' > > > with whatever is written in the text boxes? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Filtering using manually entered values
Hey, thanks for the link :) but I'm not using 1.2 :( The project I'm evolved with uses 1.1, hence my use of query in the 1st place. What do you mean a POST action? using php or is it a cake 1.2 function HttpSocket::post? Is there a way to show my dates and send them back to the controller using 1.1? Cheers, Dave On Aug 10, 2:15 am, kabturek <[EMAIL PROTECTED]> wrote: > Do a POST to the action when the users clicks submit in the form or > do this with ajax if you don't want the whole page to be refreshed > > Also why are you using query ? its only for sql that can't be handled > by cake and your's looks pretty basic. Generally you're doing a search > box. > http://wiki.kabturek.info/paginating_search_results > > not all aplies for you cause you want to do it on the same page but > look at the code and you'll find some usefull snippets > > greets, > > On Aug 10, 4:57 am, mussond <[EMAIL PROTECTED]> wrote: > > > I'd like to filter my view based on the input from the user. The > > thought is the user will enter a date range using input text boxes. > > These values would be passed to the controller and an query($sql) > > would return values I'll display in a table. > > > I can get the query and the table to work no problem but I can't find > > a way to get the date values from the view to the controller and thus > > be used in the query. > > > I've got two text inputs that contain the MIN and MAX date values from > > the database. > > > start: > > > end: > > > Also the user will filter the query by selecting a user id from a > > select box. In my controller I set this value to the variable > > $id_user, which is then used in the query(): > > > $id_user = $this->data['ComUser']['id']; > > > $this->set('data', $this->DataPoint->query("SELECT w.com_user_id, > > count(p.id) as c FROM data_points p join des_walks w WHERE > > p.des_walk_id = w.id AND w.com_user_id = '$id_user' AND p.date >= > > '2006-12-09' AND p.date <= '2006-12-10' GROUP BY w.com_user_id")); > > > So my question is how can I replace the '2006-12-09' and '2006-12-10' > > with whatever is written in the text boxes? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Filtering using manually entered values
Do a POST to the action when the users clicks submit in the form or do this with ajax if you don't want the whole page to be refreshed Also why are you using query ? its only for sql that can't be handled by cake and your's looks pretty basic. Generally you're doing a search box. http://wiki.kabturek.info/paginating_search_results not all aplies for you cause you want to do it on the same page but look at the code and you'll find some usefull snippets greets, On Aug 10, 4:57 am, mussond <[EMAIL PROTECTED]> wrote: > I'd like to filter my view based on the input from the user. The > thought is the user will enter a date range using input text boxes. > These values would be passed to the controller and an query($sql) > would return values I'll display in a table. > > I can get the query and the table to work no problem but I can't find > a way to get the date values from the view to the controller and thus > be used in the query. > > I've got two text inputs that contain the MIN and MAX date values from > the database. > > start: > > end: > > Also the user will filter the query by selecting a user id from a > select box. In my controller I set this value to the variable > $id_user, which is then used in the query(): > > $id_user = $this->data['ComUser']['id']; > > $this->set('data', $this->DataPoint->query("SELECT w.com_user_id, > count(p.id) as c FROM data_points p join des_walks w WHERE > p.des_walk_id = w.id AND w.com_user_id = '$id_user' AND p.date >= > '2006-12-09' AND p.date <= '2006-12-10' GROUP BY w.com_user_id")); > > So my question is how can I replace the '2006-12-09' and '2006-12-10' > with whatever is written in the text boxes? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Filtering using manually entered values
I'd like to filter my view based on the input from the user. The thought is the user will enter a date range using input text boxes. These values would be passed to the controller and an query($sql) would return values I'll display in a table. I can get the query and the table to work no problem but I can't find a way to get the date values from the view to the controller and thus be used in the query. I've got two text inputs that contain the MIN and MAX date values from the database. start: end: Also the user will filter the query by selecting a user id from a select box. In my controller I set this value to the variable $id_user, which is then used in the query(): $id_user = $this->data['ComUser']['id']; $this->set('data', $this->DataPoint->query("SELECT w.com_user_id, count(p.id) as c FROM data_points p join des_walks w WHERE p.des_walk_id = w.id AND w.com_user_id = '$id_user' AND p.date >= '2006-12-09' AND p.date <= '2006-12-10' GROUP BY w.com_user_id")); So my question is how can I replace the '2006-12-09' and '2006-12-10' with whatever is written in the text boxes? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---