Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/07/2018, 14:33
stevens82
 
Fecha de Ingreso: octubre-2011
Mensajes: 132
Antigüedad: 12 años, 6 meses
Puntos: 4
repetir id de columnas en cada registro asociado

Hola, estoy realizando un scirpt multilenguaje (en PHP) algo pareceido a polylang de woordpress, hasta ahora todo bien solo que necesito que en la tabla donde muestro los registros de los contenidos publicados me muestre en cada registro asociado los mismos id en sus columnas, digamos tengo esto;

es = español
en= Ingles
pt = Portugues
+ = no ha sido creado aún.

vista tabla con registros ya ingresados, donde quiero que se vea de esa manera.

id - titulo - es - en - pt
7 - Portugues - + - 6 - 7
6 - Ingles - + - 6 - 7
5 - Adeus - 3 - 4 - 5
4 - Bye - 3 - 4 - 5
3 - Adios - 3 - 4 - 5
2 - Hello - 1 - 2 - +
1 - Hola - 1 - 2 - +

tablas:
post:
Código MySQL:
Ver original
  1. CREATE TABLE `posts` (
  2.   `id` int(11) NOT NULL AUTO_INCREMENT,
  3.   `id_categoria` int(11) NOT NULL,
  4.   `imagen` varchar(45) DEFAULT NULL,
  5.   `estado` int(11) DEFAULT NULL,
  6.   `fecha_registro` datetime DEFAULT NULL,
  7.   `fecha_edicion` datetime DEFAULT NULL,
  8.   `id_usuario` int(11) NOT NULL,
  9.   `id_sibling` int(11) DEFAULT NULL,
  10.   `post_estado` int(11) DEFAULT NULL,
  11.   PRIMARY KEY (`id`)

post_langs:
Código MySQL:
Ver original
  1. CREATE TABLE `post_langs` (
  2.   `id` int(11) NOT NULL AUTO_INCREMENT,
  3.   `id_post` int(11) DEFAULT NULL,
  4.   `id_lang` int(11) DEFAULT NULL,
  5.   `titulo` varchar(255) DEFAULT NULL,
  6.   `contenido` text,
  7.   `slug` varchar(255) DEFAULT NULL,
  8.   PRIMARY KEY (`id`)

tabla langs:
Código MySQL:
Ver original
  1. CREATE TABLE `langs` (
  2.   `id` int(11) NOT NULL AUTO_INCREMENT,
  3.   `codigo` varchar(2) DEFAULT NULL,
  4.   `nombre` varchar(20) DEFAULT NULL,
  5.   PRIMARY KEY (`id`)