"SELECT * from table where status=1"
This query will be something like:
$options['fields'] = array(table.*);
$options['conditions'] = array('table.status'=>1);
$this->find('all',$options);
Regards :)
2010/11/26 Giorgio <[email protected]>
> Hi,
>
> wow. I'm testing so much on CakePHP. I absolutely love MVC frameworks.
>
> Today i've run into a new problem. I've created an application, but:
>
> - Db fields are id, name, text, date, status. id and date are set by mysql.
> Name and text should be entered by the user. Status should be set to 0 for
> every new entry. How can i do that? Of course, i can set a default value in
> mysql, but if i would set it from the application?
>
> - Then, I need a page that if opened will output a random text (WHERE
> status = 1). In a normal php script i'd use something like:
>
> $query = "SELECT * from table where status=1";
>
> $result = @mysql_query($query, db);
>
> while ($row = @mysql_fetch_array($result))
>
> $numbers[] = $row[id];
>
> And then get a random element from the numbers array. How to translate this
> in cakephp?
>
> Thanks
>
> --
> --
> AnotherNetFellow
> Email: [email protected]
>
> 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 [email protected]
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>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 [email protected]
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