Ok, I've got a system where users can create their own blogs.  The blogs 
belong to the users, the blogposts belong to the blogs.  I was trying to 
create a comparison for editing blogposts that compares the users user ID 
from their session to the Blog ID (which is the same as their User ID). 
 This way someone who doesn't own an article can't edit it.  I'm having 
trouble retrieving the blog_id from the blogposts table though.  I tried 
using this but it doesn't seem be pulling the info in.


$bid = $this->Blogpost->find(null, array('conditions' => 
array('Blogpost.id' => $id), 'fields' => array('Blogpost.blog_id')));

What I want is:

SELECT `blog_id` FROM `blogposts` WHERE id = $id

But even when I run:

$bid = $this->Blogpost->query("SELECT `blog_id` FROM `blogposts` WHERE id = 
$id");

The if statement still fails.

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to