У меня есть таблица, с которой связаны еще четыре таблицы:contact_work | филиал_работа | отдел_работа | позиция | номер_работы
контакт_работы:
Код: Выделить всё
id | id_filial | id_department | id_position | full_name | email_user | id_number | tel_number
Код: Выделить всё
id | filial
Код: Выделить всё
id | department | department_email
Код: Выделить всё
id | position
Код: Выделить всё
id | number
[img]https://i .sstatic.net/QsRpmktn.jpg[/img]
И я получаю вот этот:

Вот мой код вывода на страницу:
Код: Выделить всё
[url=workers/edit.php?id=
Код: Выделить всё
function selectAllFromContact ($table1 , $table2 , $table3 , $table4 , $table5){
global $pdo;
$sql = "SELECT
t1.id,
t1.full_name,
t1.email_user,
t1.tel_number,
t2.filial,
t3.department,
t4.position,
t5.number
FROM $table1 AS t1 INNER JOIN $table2 AS t2 ON t1. id_filial = t2.id
INNER JOIN $table3 AS t3 ON t1. id_department = t3.id
INNER JOIN $table4 AS t4 ON t1. id_position = t4.id
INNER JOIN $table5 AS t5 ON t1. id_number = t5.id";
$query = $pdo->prepare($sql);
$query->execute();
dbCheckError($query);
return $query->fetchAll();
Пытался найти ответ в Интернете, но не смог
Подробнее здесь: https://stackoverflow.com/questions/787 ... -parameter
Мобильная версия