Assemble IN clause for paginate

2011-04-28 Thread ZAky
1. I have a stored procedure that return an array of ids and can
return a comma delimited string of ids if its better
2. A have a paginator that return all the data from a table.
3. When the user perform a search I take the search parameters and
call the stored procedure.

Now I have an array or string that I want to use as a condition to the
paginator

$this-set('assets', $this-paginate(array('Asset.id IN' =
$searchTerm)));

Well its not working.

I tried to add '('.$searchTerm.')' with no success
And several more things

Thank you

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Assemble IN clause for paginate

2011-04-28 Thread AD7six

On Apr 28, 8:29 am, ZAky procsh...@gmail.com wrote:
 1. I have a stored procedure that return an array of ids and can
 return a comma delimited string of ids if its better
 2. A have a paginator that return all the data from a table.
 3. When the user perform a search I take the search parameters and
 call the stored procedure.

 Now I have an array or string that I want to use as a condition to the
 paginator

 $this-set('assets', $this-paginate(array('Asset.id IN' =
 $searchTerm)));

'Asset.id' =


 Well its not working.

what query gets executed, what query are you wanting


 I tried to add '('.$searchTerm.')' with no success

what is that supposed to do (added it where?) what did it do.

 And several more things

I also sang the sacred chant, but no extra infromation or error
messages came forth.

AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Assemble IN clause for paginate

2011-04-28 Thread euromark
your search term is an array of ids, right?
than its as easy as using

array('Asset.id' = $arrayOfIds)

because cake will automatically make an IN here


On 28 Apr., 09:25, AD7six andydawso...@gmail.com wrote:
 On Apr 28, 8:29 am, ZAky procsh...@gmail.com wrote:

  1. I have a stored procedure that return an array of ids and can
  return a comma delimited string of ids if its better
  2. A have a paginator that return all the data from a table.
  3. When the user perform a search I take the search parameters and
  call the stored procedure.

  Now I have an array or string that I want to use as a condition to the
  paginator

  $this-set('assets', $this-paginate(array('Asset.id IN' =
  $searchTerm)));

 'Asset.id' =



  Well its not working.

 what query gets executed, what query are you wanting



  I tried to add '('.$searchTerm.')' with no success

 what is that supposed to do (added it where?) what did it do.

  And several more things

 I also sang the sacred chant, but no extra infromation or error
 messages came forth.

 AD

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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