Need some help on join

Discuss mysql ajax table editor.

Need some help on join

Postby KarelB on Mon Jun 22, 2009 8:10 pm

I have a mysql-table that gets displayed with mate.
I want to add two columns from an other table.
Following the documentation and the join example I have this:
Code: Select all
$tableColumns['car_id'] = array('display_text' => 'Make', 'perms' => 'EVCAXTQS', 'join' => array('table' => 'ad_auto', 'column' => 'car_id', 'display_mask' => "make" ,'type' => 'left'));

The current table and the join table are joiend on the car_id columns. The display_mask points to the column of the join table.
So far so good.

But how do I get a second (third etc) column out of the joined table eg column 'color'.
This must be obvious but I fail to see it.

Regards

Karel
KarelB
 
Posts: 140
Joined: Mon Dec 01, 2008 11:49 pm
Location: The Netherlands

Re: Need some help on join

Postby admin on Mon Jun 22, 2009 8:57 pm

This is actually something I need to add to the documentation.

In order to do this you would create a new column definition (this column does not have to exist in the main table) and use the real_column option inside the join array to specify which column from the main table will be joined. For example:

Code: Select all
$tableColumns['fake_column_name'] = array('display_text' => 'New Column Display Text', 'perms' => 'EVCAXTQS', 'join' => array('table' => 'ad_auto', 'column' => 'car_id', 'display_mask' => "column to display", 'real_column' => 'car_id', 'type' => 'left'));
admin
Site Admin
 
Posts: 651
Joined: Fri Jul 11, 2008 1:34 am


Return to Open Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron