Re: "BETWEEN ? AND ?" turning some values into floats
Nevermind... I figured it out. The value 36 was actually a php float
type and thats why it was being converted like that by dbosource.
explicitly converting that value using intval() fixed the problem.
On Dec 7, 1:07 pm, Ozzy OG Kush <derek.rosenzw...@gmail.com> wrote:
> I even tried switching it up to the following, with no difference:
> [code]
> [1] => Array
> (
> ["T39_3"::integer >=] => 22
> ["T39_3"::integer <=] => 36
> )
> [/code]
>
> The value '36' still comes out in the query as '36.000000'.
>
> On Dec 7, 12:25 pm, Ozzy OG Kush <derek.rosenzw...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I'm using CakePHP 1.3.6, DB is postgresql 8. I tried your suggestion
> > but it did not work.
>
> > On Dec 7, 12:16 pm, Geoff Douglas <drdouglas...@gmail.com> wrote:
>
> > > What Cake version are you using here?
> > > What database server are you using?
>
> > > it appears that the values are still coming across as strings. (They are
> > > both enclosed in single quotes)
> > > You may want to edit your between clause and expicitly convert the values
> > > that you are passing in to integers.
>
> > > In MySQL this is done by wrapping the value in a CONVERT() or CAST()
> > > function.
> > > So your array would look like
>
> > > [1] => Array
> > > (
> > > ["T39_3"::integer BETWEEN CAST(? as INT) AND CAST(? as
> > > INT)] => Array
> > > (
> > > [0] => 22
> > > [1] => 36
> > > )
>
> > > )
> > > Let me know if that works.
--
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home