1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
| $table1 = array(
0 => array(
'id' => 1,
'text' => 'bidule',
),
1 => array(
'id' => 1,
'text' => 'second bidule',
),
2 => array(
'id' => 4,
'text' => 'troisième bidule',
),
);
$table2 = array(
0 => array(
'u_id' => 1,
'name' => 'genova',
),
1 => array(
'u_id' => 4,
'name' => 'flash',
),
);
/*
** SELECT table1.id, table1.bidule, table2.u_id, table2.name FROM table2 LEFT JOIN table1 ON table2.u_id = table1.id
**
** devrait retourner un tableau comme ceci :
*/
$result = array(
0 => array(
'id' => 1,
'text' => 'bidule',
'u_id' => 1,
'name' => 'genova',
),
1 => array(
'id' => 1,
'text' => 'second bidule',
'u_id' => 1,
'name' => 'genova',
),
2 => array(
'id' => 4,
'text' => 'troisieme bidule',
'u_id' => 4,
'name' => 'flash',
),
); |
Partager