In PHP how do I instead of the foreign key id, the field that has the data appears?
I have a room table that has column id
, column nome
and column tipo
.
And also I have the movie table, the movie rooms I've registered in another table and I want to call the room type, but when I put it to display in php, instead of tipo
is appearing id
of the room.
Below the table code ...
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')
)