Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82815

Unknown Column in Where Clause for Simple Join

$
0
0
Hello hello,

Quick question - I can't get my 'group_id' column to work for a where clause for my simple join of two tables (contacts & contacts_groups).

The join is working fine and the JSON returned appears to be correct. I just can't get the ->where statement to accept a value for group_id ? It works fine if I try to filter by columns in the contacts table though.

Any help would be appreciated, I'm new to DT, cheers.

$editor = Editor::inst( $db, 'contacts', 'contact_id' )
	->fields(
		Field::inst( 'contact_firstname' )
			->validator( 'Validate::required' ),
		Field::inst( 'contact_email' )
			->validator( 'Validate::email' ),
		Field::inst( 'contact_mobile' )
	)
	->join(
	Join::inst( 'contacts_groups', 'array' )
            ->join( 'contact_id', 'contact_id' )
            ->field(
                Field::inst( 'group_id' )
            )
	);
	
	$out = $editor
	->where( $key = "group_id", $value = '7', $op = '=' )
    ->process($_POST)
    ->data();

Viewing all articles
Browse latest Browse all 82815

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>