--------------------------
@giorgio,
for update /change status field in db table use
$this->Post->saveField('status','0');
or
$this->Post->saveField('status','1');
and select all active posts
$this->Post->find('All',array('conditions'=>array('status' => '1')));
On 26 stu, 13:40, Almudena Garcia <garcia.fra...@gmail.com> wrote:
> "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 <anothernetfel...@gmail.com>
>
> > 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: anothernetfel...@gmail.com
>
> > 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+unsubscribe@googlegroups.com<cake-php%2Bunsubscribe@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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment