0
In PHP as I do instead of the foreign key id, the field that has the data appears?
I have a table room that has, column id
, spine nome
and column tipo
.
And also I have the table of movies, the movie rooms I registered in another table and I want to call the type of room, but when I put to display in php, instead of the tipo
is appearing the id
living room.
Below the code of the tables...
CREATE TABLE IF NOT EXISTS `filmes` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`banner` mediumblob NOT NULL,
`nome` varchar(50) NOT NULL,
`genero` varchar(50) NOT NULL,
`tempo` varchar(50) NOT NULL,
`classificacao` varchar(50) NOT NULL,
`sala_id` int(5) NOT NULL,
`sinopse` varchar(1090) NOT NULL,
PRIMARY KEY (`id`),
KEY `sala_id_fk` (`sala_id`)
)
CREATE TABLE IF NOT EXISTS `sala` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`nome` varchar(20) NOT NULL,
`tipo` varchar(20) NOT NULL,
PRIMARY KEY (`id`)
)
Which SQL you are using?
– Sr. André Baill
I’m using the Mysqli
– Flavio Souza