| Index
» Projects
» phpMyEdit
» Forum
» join tables with phpmyedit |
 |
skeut
Joined: 18 Mar 2011
Posts: 1
Posted: 2011-03-18 15:02
Back to top
Reply with quote
|
hi,
I have to join 2 tables but I don't know how to. Here my 3 tables:
groups
usergroup
users
The table structure is as follows:
groups:
+-----------+
| groupname |
+-----------+
| gr1 |
| gr2 |
+-----------+
usergroup:
+---------------+-----------+
| username | groupname |
+---------------+-----------+
| user1 | gr1 |
| user1 | gr1 |
| user2 | gr1 |
| user3 | gr2 |
+---------------------------+
users:
+---------------+---------------+
| username | passwd |
+---------------+---------------+
| user1 | xxxxxxxx |
| user2 | xxxxxxxx |
| user3 | xxxxxxxx |
+-------------------------------+
The objective is to manage the table 'users' and the table 'groups'. Table groups, no problem.
But for the table 'users', I would like to display on each user the group to which it belongs. By adding or update a user, also have a multiple choice list (containing the groups). Is it possible to join the users and usergroup?
I cann't do this, thank you for your help
skeut
|
yazidmardiko
Joined: 14 Jul 2011
Posts: 0
Posted: 2011-07-14 21:48
Back to top
Reply with quote
|
Join table and filter should be basic and simple coding (like query in sql). But why, its becomes very difficult in PME....
Try so many example from forum and web... this simple join 2 table not working.
Use PME 5.7.1
$main_table = 'ts_project_team'; // alias of the main table
$join_table = 'ts_employee'; // alias of the values table
$join_column = 'emp_id'; // join column in the values table
$join_description = 'emp_name'; // description column in the values table
$main_column = 'prm_emp'; // join column in the main table
$opts['fdd']['prm_emp'] = array(
'name' => 'Team',
'options' => 'ACPVDFL',
'select' => 'T',
'sqlw' => 'TRIM("$val_as")',
'maxlen' => 11,
'default' => '0',
'sort' => true,
'values' => array(
'join' => '$main_table.$main_column = $join_table.$join_column',
'table' => 'ts_employee',
'column' => 'emp_id',
'description' => array(
'columns' => array($join_description)
)
);
Need working example, with real script... (many type working script of join table)
Almost gaveup with PME, just for simple joining 2 table.. Start considering MySQLAjaxTableEditor
|
|
Post new topic
Reply to topic
|
|
|
|