Many-to-many relations
Many-to-many (FK) relations can be displayed as simple multiselect fields. This method changes only fk table.
HIDE CODE
<?php $xcrud = Xcrud::get_instance(); $xcrud->table('customers'); $xcrud->columns('customerNumber,Customer orders,city'); $xcrud->fk_relation('Customer orders','customerNumber','customers_orders_fk','customer_id','order_id','orders','orderNumber',array('orderNumber','orderDate')); echo $xcrud->render(); ?>
Customers
# | Customernumber | Customer orders | City | |
---|---|---|---|---|
1 | 103 | 10180 2003-11-11 00:00:00 | Nantes | View Edit Remove |
2 | 112 | Las Vegas | View Edit Remove | |
3 | 114 | Melbourne | View Edit Remove | |
4 | 119 | Nantes | View Edit Remove | |
5 | 121 | Stavern | View Edit Remove | |
6 | 124 | San Rafael | View Edit Remove | |
7 | 125 | Warszawa | View Edit Remove | |
8 | 128 | Frankfurt | View Edit Remove | |
9 | 129 | San Francisco | View Edit Remove | |
10 | 131 | NYC | View Edit Remove |