Re: "BETWEEN ? AND ?" turning some values into floats

2011-12-07 Thread Ozzy OG Kush
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  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.00'.
>
> On Dec 7, 12:25 pm, Ozzy OG Kush  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  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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: "BETWEEN ? AND ?" turning some values into floats

2011-12-07 Thread Ozzy OG Kush
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.00'.

On Dec 7, 12:25 pm, Ozzy OG Kush  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  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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: "BETWEEN ? AND ?" turning some values into floats

2011-12-07 Thread Ozzy OG Kush
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  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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


"BETWEEN ? AND ?" turning some values into floats

2011-12-07 Thread Ozzy OG Kush
I have a situation where I have to add a "BETWEEN ? AND ?" condition
to a set of queries. The strangest thing happens though - certain
values get turned into floats.

Here's an example of the conditions that CakePHP sends to model-
>find():
[code]
Array
(
[SurveyData.SS_COMPLETE] => 1
[AND] => Array
(
[0] => Array
(
[NOT] => Array
(
["T29_1"::integer] =>
)

[SurveyData.SS_COMPLETE] => 1
)

[1] => Array
(
["T39_3"::integer BETWEEN ? AND ?] => Array
(
[0] => 22
[1] => 36
)

)

)

)[/code]

Seems straightforward enough right? Here's the query that gets
generated:
SELECT [...] AS "SurveyData"   WHERE "SurveyData"."SS_COMPLETE" = '1'
AND NOT ("T29_1"::integer IS NULL))  AND
("SurveyData"."SS_COMPLETE" = '1'))) AND ("T39_3"::integer BETWEEN
'22' AND '36.00'))

>From what I can tell, it only seems to happen when the value is '36'
and it doesn't matter if it's after the "BETWEEN" word or after the
"AND" word. The field "T39_3" is a text field and that cannot be
changed on the table itself, hence why I am converting to ::integer.
Any idea what could be causing this?

-- 
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: data source not properly quoting casted fields in conditions array

2011-10-05 Thread Ozzy OG Kush
Unfortunately our DB engineer does not want to add any kind of
implicit casting to the DB because it may break other things. I'm
trying to avoid duplicating the work that DboSource->read() does in
case future versions of Cake modify the way they do things, because
that solution had not escaped me.

On Oct 5, 1:35 pm, José Lorenzo  wrote:
> You need to use $this->getDatasource()->expression() for those cases.
> CakePHP does not handle all database details such as explicit casting. It
> might be better to define an implicit cast function inside postgresql.
>
> Cheers

-- 
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


data source not properly quoting casted fields in conditions array

2011-10-05 Thread Ozzy OG Kush
I believe I have found a bug in CakePHP. I have a complex array of
conditions being passed into a model->find() call. The field in the
database is always a 'text' datatype (postgresql), but sometimes acts
as a number and therefore I have to cast it, and its NOT possible to
switch these datatypes because the fields are dynamically created. If
I want to pass a condition such as:

array('"FIELD_NAME"::integer' => array(0, 1, 4, 5, 9))

to my find call, it will strip out the quotes from "FIELD_NAME" and
the query will fail. However, if I do a query such as

array('"FIELD_NAME"::integer' => 5))
or
array('"FIELD_NAME"::integer between ? and ?' => array(0, 9))

it seems to keep the quotes around "FIELD_NAME" and the query works.

We're using CakePHP 1.3.6... if this has already been addressed please
let me know! It's very frustrating and I really do not want to have to
create custom queries for these specific cases since Cake SHOULD
handle it correctly.

-- 
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: Need help getting site to work

2008-10-26 Thread Ozzy OG Kush

Nevermind, I figured it out, it was a simple permissions problem.

As for telling cake to never display SQL connection errors, anyone
have any suggestions? My hosting service's database server goes down
more frequently than I'd like, and even with debug on 0 my site will
display SQL connection errors (showing file paths and such), which I
don't want to happen. Thoughts/suggestions?

On Oct 25, 6:35 pm, Ozzy OG Kush <[EMAIL PROTECTED]> wrote:
> I'm using CakePHP 1.1, and Apache 2.2.
>
> On Oct 24, 4:45 pm, Ozzy OG Kush <[EMAIL PROTECTED]> wrote:
>
> > Here's my situation. I have my site (http://www.phillynorml.org/) set
> > up in a production environment (index.php, .htaccess, img, css, js,
> > etc in ../DocumentRoot, everything else in ../cake, and it's working
> > great for the most part.
>
> > The problem is that in DocumentRoot I have another folder with a perl
> > program in it, but when you go to the URL of that program, cake throws
> > up a 404 error (http://www.phillynorml.org/medijuana/showpage.pl?
> > page=main) .
>
> > How can I set it up so that it will run?
>
> > Also, on a semi-related note, how can I tell cake to never display SQL
> > connection errors?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Need help getting site to work

2008-10-25 Thread Ozzy OG Kush

I'm using CakePHP 1.1, and Apache 2.2.

On Oct 24, 4:45 pm, Ozzy OG Kush <[EMAIL PROTECTED]> wrote:
> Here's my situation. I have my site (http://www.phillynorml.org/) set
> up in a production environment (index.php, .htaccess, img, css, js,
> etc in ../DocumentRoot, everything else in ../cake, and it's working
> great for the most part.
>
> The problem is that in DocumentRoot I have another folder with a perl
> program in it, but when you go to the URL of that program, cake throws
> up a 404 error (http://www.phillynorml.org/medijuana/showpage.pl?
> page=main) .
>
> How can I set it up so that it will run?
>
> Also, on a semi-related note, how can I tell cake to never display SQL
> connection errors?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Need help getting site to work

2008-10-24 Thread Ozzy OG Kush

Here's my situation. I have my site (http://www.phillynorml.org/) set
up in a production environment (index.php, .htaccess, img, css, js,
etc in ../DocumentRoot, everything else in ../cake, and it's working
great for the most part.

The problem is that in DocumentRoot I have another folder with a perl
program in it, but when you go to the URL of that program, cake throws
up a 404 error (http://www.phillynorml.org/medijuana/showpage.pl?
page=main) .

How can I set it up so that it will run?


Also, on a semi-related note, how can I tell cake to never display SQL
connection errors?
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: I can not solve "Session - losing value after redirect" problem after I read all previous posts.

2008-05-22 Thread Ozzy OG Kush

I'm having the same problem!!! It simply won't save sessions for me.

On Apr 14, 1:49 pm, columbus <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am a beginner in both php andcakePHP. I have met the same problem
> as many previous posts. However, I have tried most of the solutions
> and it is still not working.
>
> I was just following the IBM Tutorial "Cook up Web sites fast withCakePHP" to 
> learn how to write the script for login. However, after
> seccessfully login, thesessioninformation such as $_SESSION['user']
> were not saved if I use the redirect() function. To sovle the problem,
> I modified my code so that it will redirect to the same login page and
> echosessionvariables andsessionid.
> After redirection, thesessionvariables are missing and thesession
> id is always the same. If I comment these two lines
> "$this->redirect('/users/login');
>  $this->exit();"
> I can see the correctsessionvariables and the samesessionid. That
> means they were saved.
> My question is that is it possible to keep thesessionvariables after
> redirect to other pages without configurate Apache server since it is
> in the university.
>
> The code is as following, and my system is WinXP
> +Apache2.0.59+MySQL5.0.45+PHP4.4.7+cakePHP1.1.19.6305.
> Here are the methods I have already tried and did not work.
> 1.set the security level in core.php to low.
> 2.apply function exit();
> 3.I tried to comment out the lines as Grant Cox mentioned in thesession.php.
>
> In users_controller.php
>
> function login()
>   {
>$this->set('error', false);
>if ($this->data)
> {
>  $results = $this->User->findByUsername($this->data['User']
> ['username']);
>   if ($results && $results['User']['password'] 
> ==md5($this->data['User']['password']))
>
>{
> $this->Session->write('username',$this->data['User']
> ['username']);
> $results['User']['last_login'] = date("Y-m-d H:i:s");
> $this->Session->write('last_login',$results['User']
> ['last_login']);
> $this->redirect('/users/login');
> $this->exit();
>}
>else
>{
> $this->set('error', true);
> }
> }
>}
>
> In login.thtml
>  var_dump($_SESSION);
> echo ("sessionid is ".session_id());
> if ($error)
>  {
>  e('InvalidLogin.');
>   }
>  ?>
> Please log in.
> 
> formTag('/users/login')?>
> Username:
> inputTag('User/username', array('size' => '40')) ?>
> Password:
> password('User/password', array('size' => '20')) ?>
> submitTag('Login') ?>
> 
> link('register', '/users/register') ?>
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Session problem

2008-05-21 Thread Ozzy OG Kush

Hey,

I am having this same exact problem! I'm using CakePHP 1.1.19.6305 .

This is very frustrating! Any help would be very appreciated.

On Apr 23, 11:45 am, creationsings <[EMAIL PROTECTED]> wrote:
> Did you ever find a solution to this?  I think I am experiencing a
> similar problem.  I can write to a session variable, but I can only
> read the valid value if I do so before the action completes.  Once the
> action completes and a new one is called, the session information is
> gone.  I am extremely new to cake and would love to know the solution.
> Thanks!
>
> On Apr 17, 3:03 pm, Ramiro Araujo <[EMAIL PROTECTED]> wrote:
>
> > I still have not succeded in this... The strange thing is that im
> > using the Auth component, and im pretty sure It uses sessions. What I
> > dont know if it uses them with $_SESSION or with thesession
> > component, but I would bet for the second.
>
> > Quite strange.. I'll try in other cake instalations around and see.
>
> > On Apr 15, 10:38 am, Ramiro Araujo <[EMAIL PROTECTED]> wrote:
>
> > > Hi, thanks! here it is:
>
> > > Configure::write('Session.save', 'php'); //also tried with 'cake'
> > > Configure::write('Session.cookie', 'CAKEPHP');
> > > Configure::write('Session.timeout', '120');
> > > Configure::write('Session.start', true);
> > > Configure::write('Session.checkAgent', true); //also tried with false
> > > Configure::write('Security.level', 'low');
>
> > > Right now im asigning with $_SESSION and reading withSession
> > > Component :D hahahah
>
> > > Thanks for the help!
>
> > > On Apr 14, 3:58 pm, "b logica" <[EMAIL PROTECTED]> wrote:
>
> > > > How is your core.php configured? Post what you have for all
> > > > Configure::write('Session.*', '...') and whether they are uncommented
> > > > or not.
>
> > > > On Mon, Apr 14, 2008 at 1:35 PM,RamiroAraujo <[EMAIL PROTECTED]> wrote:
>
> > > > >  Hi. Im having a strange problem, and couldn't find any solution or
> > > > >  anyone with a similar problem... Its quite simple:
>
> > > > >  same controller, 2 methods:
>
> > > > >  function sessionWriteTest ($key, $value) {
> > > > >         $this->Session->write($key, $value);
> > > > >  }
> > > > >  function sessionReadTest ($key) {
> > > > >         debug($this->Session->read($key));
> > > > >  }
>
> > > > >  doesnt work...
>
> > > > >  modifying the method sessionWriteTest like this, works:
> > > > >  function sessionWriteTest ($key, $value) {
> > > > >         $_SESSION[$key] = $value;
> > > > >  }
>
> > > > >  Am I missing something really simple? My config is set quite default,
> > > > >  temp directories are chmod 777, and normalsessionhandling works!
>
> > > > >  Thanks!

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---