Re: Query question(s)

2010-06-10 Thread Ed Propsner
@John: I "think" I'm able to wrap my head around the concept. My project is extremely search heavy and if I'm following you correctly I can see a few distinct advantages to your system. What I like the most is being able to keep a history of searches within the session. I see a catastrophe just wa

Re: Query question(s)

2010-06-10 Thread John Andersen
I am using the DB to store the search criteria and the result. Not that the result creates more information, it creates only relationships between the stored search criteria and the existing records in other tables. The search is currently only based on one subject, either Article, Blog, Ebook, or

Re: Query question(s)

2010-06-10 Thread Ed Propsner
So I was a tad mistaken in my last post, displaying the tinyint data in user profiles didn't cut down on the code, it added a touch more but that's okay, it works just fine. ie. // SEEKING DATA $values = array(1,2,4,8,16,32,64); $storedValue = $user['Seeking']['seeking']; $seeking = array(); if(

Re: Query question(s)

2010-06-09 Thread Ed Propsner
@Calvin: I have very little experience with bitwise operations but if the concept was totally escaping me and you saw this don't ever be hesitant to tell me I'm being a dummy. I have no reservations with diving into a tutorial and picking up on something new. I never expect the answer but will alw

Re: Query question(s)

2010-06-09 Thread calvin
Manipulating bit fields can be confusing at times (e.g. on Monday it took me a while to realize the query in my original post didn't do what I thought it would), and there's usually more than one way to do it. But, basically, the way I approached it was to group all of the OR conditions together an

Re: Query question(s)

2010-06-08 Thread Ed Propsner
@Calvin: I do like the idea of using array_sum() and storing the options as an INT, I've taken this approach in the past with a different app (once) and it worked out just fine. In this case let's say you have a value of 3 stored in the db representing 2 options ... '1' => 'video, '2' => 'audio. A

Re: Query question(s)

2010-06-08 Thread John Andersen
This may not be relevant to your issue, but maybe to your solution. I will try to explain how I did my search functionality. In my application, the user will search for a specific object (Article, Author, Blog, etc.), not a combination of these. The search form provides the following entries: Wor

Re: Query question(s)

2010-06-07 Thread calvin
Ack, that example wasn't very good either, so let's try _one_ more time... Say you want to do a search for records that conform to these conditions: -must be of _both_ type Video AND Photo -must also be _either_ type Audio OR Text then $andOptions would be 5; $orOptions would be 10. On Jun 7, 7:

Re: Query question(s)

2010-06-07 Thread calvin
(My earlier post was inaccurate so I removed it. Let's try this again...) I don't think you need buildStatement() in this case as your query, although long, shouldn't actually be that complex, even if you end up with both OR and AND conditions. You just need to take a look at how OR/AND conditions

Re: Query question(s)

2010-06-07 Thread calvin
I don't think you need buildStatement() in this case as your query, although long, shouldn't actually be that complex, even if you end up with both OR and AND conditions. You just need to take a look at how OR/AND conditions are constructed in find() and then use them to build custom pagination que

Re: Query question(s)

2010-06-07 Thread Ed Propsner
@John: [quote] Can you explain why you have not separated/normalized the "SomeCol.contents"? And do you have other such columns in your database? [/quote] No, that is the only column in the db that stores multiple values in one field (that aren't for display only). At one point in time the data

Re: Query question(s)

2010-06-07 Thread calvin
If all of your search options are OR conditions, then you could theoretically do something like this: SELECT ... WHERE contents REGEXP '(opt1|opt2|opt3|opt4|opt5|opt6)'; http://dev.mysql.com/doc/refman/5.0/en/regexp.html#operator_regexp On Jun 6, 1:24 pm, Ed Propsner wrote: > I found a usable so

Re: Query question(s)

2010-06-07 Thread calvin
I'm not sure what you ought to do about the custom query (you may just have to build it the hard way or do as Ed suggest and redesign the DB), but regarding the URL, there are a few ways to go about it. Firstly, I should point out that the URL you wrote doesn't look right. Usually, with something

Re: Query question(s)

2010-06-07 Thread John Andersen
Based on what you have posted I would ask whether a redesign of the database would be a better idea! I refer to the issue you have created yourself, by having one column contain more than one value at the same time: [quote] ... The problem I'm running into is that $array can contain any number and

Re: Query question(s)

2010-06-06 Thread Ed Propsner
I found a usable solution, a bit exhaustive and long-winded perhaps, but usable nonetheless. I still need to put together a dynamic query and I'm finding myself avoiding having to do it at this time. I need to build a query dynamically based on what elements a user chooses from a form. There coul

Re: Query question(s)

2010-06-05 Thread Ed Propsner
Perhaps I'm over-complicating this but I'm still having some problems with building my query. I'm looking to do something like: $array = array (A, B, C, D, E); $list = implode( ',' , $array); 'conditions' => array( 'SomeCol.contents' => array($list)

Re: Query question(s)

2010-06-04 Thread Ed Propsner
Thanks Calvin, point well taken. I'll just stick with GET like I always have for searches. I tweaked the routing and got things cleaned up a bit so I guess I'm okay with it. I'm not quite sure what I was expecting in the first place? 8-) The search uses a lot of checkboxes and results in somethin

Re: Query question(s)

2010-06-04 Thread calvin
POST requests are generally not cached, but you can force it to be cached using the Cache-Control and Expires headers. However, I've never tried this so I don't know if the browser will still show the form submission dialog (it may need to resend the form data to check to see if the document has ch

Re: Query question

2009-04-24 Thread brian
I don't think the number of characters in a query makes too much difference. Not compared to how the query is formulated, in any case. It's also not so much a Cake thing as between your DB and its PHP wrapper. But, again, it's likely the least thing to be concerned about. On Fri, Apr 24, 2009 at

Re: Query question

2009-04-14 Thread Richard
You could possibly do a UNION query? If you need to know which table they came from, add a hard-coded value to the field list ('TableA' as which_table). SELECT id, firstname, lastname FROM tableA where email = 'a...@b.com' UNION SELECT id, firstname, lastname FROM tableB where email = 'a...@b.com'

Re: Query Question

2008-05-12 Thread grigri
// Controller $parks = $this->Skatepark->find('list', array( 'fields' => array( 'Skatepark.id', // Key path 'Skatepark.city', // Value path 'Skatepark.state' // Group path ), 'order' => 'Skatepark.city ASC, Skatepark.state ASC' ); $this->set(compact('parks')); // parks looks lik

Re: Query Question

2008-05-12 Thread Filip Camerman
I'd just use SELECT state, city FROM skateparks ORDER BY state, city Then loop it end everytime the state changes you print the state, otherwise just the city. On May 12, 12:39 pm, Kyle Decot <[EMAIL PROTECTED]> wrote: > They're not stored in separate tables. They're stored in my skateparks >

Re: Query Question

2008-05-12 Thread Sam Sherlock
look at self relating the table by using a field named parent_id if your baking cake will recognise that the relationship is a child/parent id | parent id | name | address | city | state ...etc 2008/5/12 Kyle Decot <[EMAIL PROTECTED]>: > > They're not stored in separate tables. They'r

Re: Query Question

2008-05-12 Thread Kyle Decot
They're not stored in separate tables. They're stored in my skateparks table which has: id | name | address | city | state ...etc --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to

Re: Query Question

2008-05-11 Thread Grant Cox
City belongsTo State Assuming Cake 1.2: $cities = $this->City->find('list', array('fields'=>array('City.id', City.name', 'State.name'), 'recursive'=>1) ); Then you can have a form select with cities as the data source, you should get exactly what you want. On May 12, 9:00 am, Kyle Decot <[EMAI

Re: Query Question

2008-04-02 Thread Dan
I figured it out $this->Game->bindModel( array('hasOne' => array( 'CategoriesGame' => array( 'className' => 'CategoriesGame' ) )),

Re: Query Question

2008-04-02 Thread Dan
Thanks for the note but I can't get conditions to work because it's a HABTM relationship. I tried $this->paginate('Game', "Category.name = 'puzzle'"); but it gives me SQL Error: 1054: Unknown column 'Category.id' in 'where clause' The query doesn't join Category to Game so it has no idea what

Re: Query Question

2008-04-02 Thread [EMAIL PROTECTED]
you set your conditions in the paginate variable. Example: class GamesController extends AppController { var $name = 'Games'; var $paginate = array( 'Game' => array( 'limit'=>10, 'order'=> 'Game.id ASC',