Hello... you are get your project title $title =
$this->Project->field('title',array('condition'=>'condition'));
On Thursday, October 18, 2012 5:12:42 AM UTC-4, Cody Sortore wrote:
>
> Okay, I'm a bit of a noob, but I've been messing with this all night and
> cannot figure it out. I've had this problem before, but just figured out
> what my problem is, and although this particular issue isn't pressing,
> because I plan to use a similar item in the future I would like to
> understand what I'm missing here.
>
> I'm looking for a way to read a single item from the database, I can pass
> it to the view rather easily, but reading it in the same controller is
> confounding me.
>
> I've tried:
>
> $title = $this->Project->read('title');
> $title = $this->Project->find('first', array('fields' =>
> array('Project.title'), 'conditions' => array('Project.id' => $id)));
> $title = $this->Project->query("SELECT `title` FROM `Projects` WHERE
> `id`=$id");
>
> All I'm trying to do is display a message that says "Hey you deleted this
> project" later I have
>
> $this->Session->setFlash(__("Project $title deleted"));
>
> However, when the message flashes all I see "Project Array deleted" with
> all three examples. I understand what it's doing... I just don't
> understand why... how do I select the actual "title" from the array,
> instead of the entire array?
>
> Using CakePHP 2.x if it makes a difference in this instance.
>
>
--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
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].
Visit this group at http://groups.google.com/group/cake-php?hl=en.