Mal Blackshaw Fri Apr 20 05:06:57 -0400 2012

Subject: Joins

Can some cast their expert eye on this and explain why it's not pulling data, I'm not that great at technical language, but understand by examples, but I'm a bit stuck on the joining of 2 tables... I'm using Slim Framework, Twig & ActiveRecord

I have 2 tables, pages & partials
pages is the main table with PK = id and the partials table has the Fk = pgid
id relates to pgid and thus should pull the data out of the table once executed.
This is the Joining Code in the app:

$app->get('/', function () use ($app) {
$join = 'LEFT JOIN partials a ON( = partials.pgid )'; $data['page'] = Page::find_by_safeurl('home', array('joins' => $join));
$data['navigation'] = Page::find('all', array('conditions' => array('status = ?', '1')));
$app->render('site/content.html', $data);

If i leave it as ( = partial.pgid) it errors 42S22, 1054, Unknown column 'partials.pgid' in 'on clause'
but if i remove the partials and have ( = pgid) it doesn't error or pull any data through
This is the Twig code to pull the data:

{% block partial %} {% for page in join %} {{partial.article}} {% endfor %} {% endblock %}

It's probably something simple I've missed but for the life of me I can't see it..

Thanks in advance Mal