Re: Build Query

2010-10-26 Thread Briko03
Thanks for this much betterI am still learning.

On Oct 26, 6:32 am, Marco  wrote:
> I agree with Miles.
>
> $this->paginate =
> array('conditions'=>array('Result.location'=>'Sundown'));
> $this->set('results', $this->paginate('Result'));
>
> On Oct 25, 5:38 pm, Miles J  wrote:
>
> > Why are you setting $results twice?
>
> > If you want pagination, use paginate(), you dont need the other query.
>
> > On Oct 25, 11:39 am, Briko03  wrote:
>
> > > It looks like the first query is working as it should. I  am positive
> > > there is a location field.
>
> > > Here is a snapshot of the table
>
> > > When I run the first query it works fine and returns 2615 records.
>
> > > I think it has something to do with the pagination perhaps?
>
> > > On Oct 25, 1:50 pm, Jeremy Burns | Class Outfit
>
> > >  wrote:
> > > > Are you certain you have a row in your database that matches that 
> > > > criteria? The SQL looks right, but the count is zero. What happens when 
> > > > you run the SQL directly against the database?
>
> > > > Jeremy Burns
> > > > Class Outfit
>
> > > > jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > > > On 25 Oct 2010, at 13:46, Briko03 wrote:
>
> > > > > I have a field named location.
>
> > > > > This is what is coming throu from cake
>
> > > > > SHOW FULL COLUMNS FROM `results`           14      14      3
> > > > > 2  SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE
> > > > > COLLATION_NAME= 'utf8_general_ci';         1       1       1
> > > > > 3  SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`,
> > > > > `Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`,
> > > > > `Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`,
> > > > > `Result`.`best`, `Result`.`points`, `Result`.`season`,
> > > > > `Result`.`location` FROM `results` AS `Result` WHERE
> > > > > `Result`.`location` = 'Sundown'            2615    2615    7
> > > > > 4  SELECT COUNT(*) AS `count` FROM `results` AS `Result` WHERE 1 = 1
> > > > > 1  1       0
> > > > > 5  SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`,
> > > > > `Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`,
> > > > > `Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`,
> > > > > `Result`.`best`, `Result`.`points`, `Result`.`season`,
> > > > > `Result`.`location` FROM `results` AS `Result` WHERE 1 = 1 LIMIT 100
> > > > > 100        100     1
>
> > > > > Check out the new CakePHP Questions 
> > > > > sitehttp://cakeqs.organdhelpotherswith their CakePHP related 
> > > > > questions.
>
> > > > > You received this message because you are subscribed to the Google 
> > > > > Groups "CakePHP" group.
> > > > > To post to this group, send email to cake-php@googlegroups.com
> > > > > To unsubscribe from this group, send email to
> > > > > cake-php+unsubscr...@googlegroups.com For more options, visit this 
> > > > > group athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Build Query

2010-10-26 Thread Marco
I agree with Miles.

$this->paginate =
array('conditions'=>array('Result.location'=>'Sundown'));
$this->set('results', $this->paginate('Result'));

On Oct 25, 5:38 pm, Miles J  wrote:
> Why are you setting $results twice?
>
> If you want pagination, use paginate(), you dont need the other query.
>
> On Oct 25, 11:39 am, Briko03  wrote:
>
>
>
>
>
>
>
> > It looks like the first query is working as it should. I  am positive
> > there is a location field.
>
> > Here is a snapshot of the table
>
> > When I run the first query it works fine and returns 2615 records.
>
> > I think it has something to do with the pagination perhaps?
>
> > On Oct 25, 1:50 pm, Jeremy Burns | Class Outfit
>
> >  wrote:
> > > Are you certain you have a row in your database that matches that 
> > > criteria? The SQL looks right, but the count is zero. What happens when 
> > > you run the SQL directly against the database?
>
> > > Jeremy Burns
> > > Class Outfit
>
> > > jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > > On 25 Oct 2010, at 13:46, Briko03 wrote:
>
> > > > I have a field named location.
>
> > > > This is what is coming throu from cake
>
> > > > SHOW FULL COLUMNS FROM `results`           14      14      3
> > > > 2  SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE
> > > > COLLATION_NAME= 'utf8_general_ci';         1       1       1
> > > > 3  SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`,
> > > > `Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`,
> > > > `Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`,
> > > > `Result`.`best`, `Result`.`points`, `Result`.`season`,
> > > > `Result`.`location` FROM `results` AS `Result` WHERE
> > > > `Result`.`location` = 'Sundown'            2615    2615    7
> > > > 4  SELECT COUNT(*) AS `count` FROM `results` AS `Result` WHERE 1 = 1
> > > > 1  1       0
> > > > 5  SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`,
> > > > `Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`,
> > > > `Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`,
> > > > `Result`.`best`, `Result`.`points`, `Result`.`season`,
> > > > `Result`.`location` FROM `results` AS `Result` WHERE 1 = 1 LIMIT 100
> > > > 100        100     1
>
> > > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelpothers 
> > > > with their CakePHP related questions.
>
> > > > You received this message because you are subscribed to the Google 
> > > > Groups "CakePHP" group.
> > > > To post to this group, send email to cake-php@googlegroups.com
> > > > To unsubscribe from this group, send email to
> > > > cake-php+unsubscr...@googlegroups.com For more options, visit this 
> > > > group athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Build Query

2010-10-25 Thread Miles J
Why are you setting $results twice?

If you want pagination, use paginate(), you dont need the other query.

On Oct 25, 11:39 am, Briko03  wrote:
> It looks like the first query is working as it should. I  am positive
> there is a location field.
>
> Here is a snapshot of the table
>
> When I run the first query it works fine and returns 2615 records.
>
> I think it has something to do with the pagination perhaps?
>
> On Oct 25, 1:50 pm, Jeremy Burns | Class Outfit
>
>  wrote:
> > Are you certain you have a row in your database that matches that criteria? 
> > The SQL looks right, but the count is zero. What happens when you run the 
> > SQL directly against the database?
>
> > Jeremy Burns
> > Class Outfit
>
> > jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> > On 25 Oct 2010, at 13:46, Briko03 wrote:
>
> > > I have a field named location.
>
> > > This is what is coming throu from cake
>
> > > SHOW FULL COLUMNS FROM `results`           14      14      3
> > > 2  SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE
> > > COLLATION_NAME= 'utf8_general_ci';         1       1       1
> > > 3  SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`,
> > > `Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`,
> > > `Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`,
> > > `Result`.`best`, `Result`.`points`, `Result`.`season`,
> > > `Result`.`location` FROM `results` AS `Result` WHERE
> > > `Result`.`location` = 'Sundown'            2615    2615    7
> > > 4  SELECT COUNT(*) AS `count` FROM `results` AS `Result` WHERE 1 = 1
> > > 1  1       0
> > > 5  SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`,
> > > `Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`,
> > > `Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`,
> > > `Result`.`best`, `Result`.`points`, `Result`.`season`,
> > > `Result`.`location` FROM `results` AS `Result` WHERE 1 = 1 LIMIT 100
> > > 100        100     1
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others 
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups 
> > > "CakePHP" group.
> > > To post to this group, send email to cake-php@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Build Query

2010-10-25 Thread Briko03
It looks like the first query is working as it should. I  am positive
there is a location field.

Here is a snapshot of the table



When I run the first query it works fine and returns 2615 records.

I think it has something to do with the pagination perhaps?

On Oct 25, 1:50 pm, Jeremy Burns | Class Outfit
 wrote:
> Are you certain you have a row in your database that matches that criteria? 
> The SQL looks right, but the count is zero. What happens when you run the SQL 
> directly against the database?
>
> Jeremy Burns
> Class Outfit
>
> jeremybu...@classoutfit.comhttp://www.classoutfit.com
>
> On 25 Oct 2010, at 13:46, Briko03 wrote:
>
> > I have a field named location.
>
> > This is what is coming throu from cake
>
> > SHOW FULL COLUMNS FROM `results`           14      14      3
> > 2  SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE
> > COLLATION_NAME= 'utf8_general_ci';         1       1       1
> > 3  SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`,
> > `Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`,
> > `Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`,
> > `Result`.`best`, `Result`.`points`, `Result`.`season`,
> > `Result`.`location` FROM `results` AS `Result` WHERE
> > `Result`.`location` = 'Sundown'            2615    2615    7
> > 4  SELECT COUNT(*) AS `count` FROM `results` AS `Result` WHERE 1 = 1
> > 1  1       0
> > 5  SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`,
> > `Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`,
> > `Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`,
> > `Result`.`best`, `Result`.`points`, `Result`.`season`,
> > `Result`.`location` FROM `results` AS `Result` WHERE 1 = 1 LIMIT 100
> > 100        100     1
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd help others 
> > with their CakePHP related questions.
>
> > You received this message because you are subscribed to the Google Groups 
> > "CakePHP" group.
> > To post to this group, send email to cake-php@googlegroups.com
> > To unsubscribe from this group, send email to
> > cake-php+unsubscr...@googlegroups.com For more options, visit this group 
> > athttp://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Build Query

2010-10-25 Thread Jeremy Burns | Class Outfit
Are you certain you have a row in your database that matches that criteria? The 
SQL looks right, but the count is zero. What happens when you run the SQL 
directly against the database?

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 25 Oct 2010, at 13:46, Briko03 wrote:

> I have a field named location.
> 
> 
> This is what is coming throu from cake
> 
> SHOW FULL COLUMNS FROM `results`  14  14  3
> 2 SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE
> COLLATION_NAME= 'utf8_general_ci';1   1   1
> 3 SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`,
> `Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`,
> `Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`,
> `Result`.`best`, `Result`.`points`, `Result`.`season`,
> `Result`.`location` FROM `results` AS `Result` WHERE
> `Result`.`location` = 'Sundown'   261526157
> 4 SELECT COUNT(*) AS `count` FROM `results` AS `Result` WHERE 1 = 1
> 1 1   0
> 5 SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`,
> `Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`,
> `Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`,
> `Result`.`best`, `Result`.`points`, `Result`.`season`,
> `Result`.`location` FROM `results` AS `Result` WHERE 1 = 1 LIMIT 100
> 100   100 1
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Build Query

2010-10-25 Thread Briko03
I have a field named location.


This is what is coming throu from cake

SHOW FULL COLUMNS FROM `results`14  14  3
2   SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.COLLATIONS WHERE
COLLATION_NAME= 'utf8_general_ci';  1   1   1
3   SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`,
`Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`,
`Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`,
`Result`.`best`, `Result`.`points`, `Result`.`season`,
`Result`.`location` FROM `results` AS `Result` WHERE
`Result`.`location` = 'Sundown' 261526157
4   SELECT COUNT(*) AS `count` FROM `results` AS `Result` WHERE 1 = 1
1   1   0
5   SELECT `Result`.`id`, `Result`.`racenum`, `Result`.`bib`,
`Result`.`fname`, `Result`.`lname`, `Result`.`sex`, `Result`.`class`,
`Result`.`team`, `Result`.`firstrun`, `Result`.`secondrun`,
`Result`.`best`, `Result`.`points`, `Result`.`season`,
`Result`.`location` FROM `results` AS `Result` WHERE 1 = 1 LIMIT 100
100 100 1

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Build Query

2010-10-25 Thread Jeremy Burns | Class Outfit
Do you have a field named 'location' or is it 'name'? If it's name, you'd need 
to do findAllByName.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 25 Oct 2010, at 13:30, Briko03 wrote:

> Any idea why this wouldn't be returning results with a location=
> sundown??
> 
> 
> 
> function sundown()
> {
> $this->set('results',$this->Result->findAllBylocation('Sundown'));
> $this->set('results', $this->paginate('Result'));
> }
> 
> Check out the new CakePHP Questions site http://cakeqs.org and help others 
> with their CakePHP related questions.
> 
> You received this message because you are subscribed to the Google Groups 
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
> http://groups.google.com/group/cake-php?hl=en

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Build Query

2010-10-25 Thread Briko03
Any idea why this wouldn't be returning results with a location=
sundown??



function sundown()
{
$this->set('results',$this->Result->findAllBylocation('Sundown'));
$this->set('results', $this->paginate('Result'));
}

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Build Query

2010-10-25 Thread Tilen Majerle
http://book.cakephp.org/view/1017/Retrieving-Your-Data

 
--
Tilen Majerle
http://majerle.eu



2010/10/25 Briko03 

> I have a controller that does a find all to get all the results from
> our database:
>
> var $name = 'Results';
>function index(){
> $this->set('results',$this->Result->find('all'));
> $this->set('results', $this->paginate('Result')); }}
>
>
>
> I want to build a function that can get parameter(s) from the url to
> build the query instead of returning 'all'
> Can anyone help me with this?
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to cake-php@googlegroups.com
> To unsubscribe from this group, send email to
> cake-php+unsubscr...@googlegroups.comFor
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en