Good day, people. I'm a beginner in php and I'm developing a program for file box control. I have a database in which the "box" table is the main one, it has several references to other tables. Here's how:
<br>CREATE TABLE 'caixa' (<br>
'nro_caixa' int(6) NOT NULL,<br>
'auditor' varchar(150) NOT NULL,<br>
'id_cliente' int(5) NOT NULL,<br>
'observacao' text NOT NULL,<br>
'data_ini' date DEFAULT NULL,<br>
'data_fin' date DEFAULT NULL,<br>
'tipo_caixa' int(2) DEFAULT NULL,<br>
'data_cadastro' datetime NOT NULL,<br>
'data_descarte' datetime DEFAULT NULL,<br>
'obs_descarte' varchar(150) NOT NULL,<br>
'res_descarte' int(3) DEFAULT NULL,<br>
'id_departamento' int(3) DEFAULT NULL,<br>
'id_unidade' int(3) DEFAULT NULL,<br>
'id_tipo_doc' int(10) NOT NULL,<br>
'id_status' int(11) NOT NULL,<br>
'id_prateleira' int(11) DEFAULT NULL,<br>
'id_caixa' int(11) NOT NULL AUTO_INCREMENT,<br>
PRIMARY KEY ('id_caixa'),<br>
KEY 'id_status' ('id_status'),<br>
KEY 'id_prateleira' ('id_prateleira'),<br>
KEY 'res_descarte' ('res_descarte'),<br>
KEY 'id_unidade' ('id_unidade'),<br>
KEY 'id_tipo_doc' ('id_tipo_doc'),<br>
KEY 'id_departamento' ('id_departamento'),<br>
KEY 'id_cliente' ('id_cliente')<br>
)
ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=37259 ;
I need a way to get information from other tables such as document type names, unit name, profile name, shelf name, and department name that are fields in other tables.
What I've tried so far:
SELECT <br>a.id_caixa,<br> a.nro_caixa,<br> a.auditor,<br> a.observacao,<br> a.data_ini,<br> a.data_fin,<br> a.tipo_caixa,<br> b.nome,<br> c.nome,<br> d.nome,<br> e.nome,<br> f.nome<br>
FROM CAIXA AS a<br>
INNER JOIN clientes AS b<br>
INNER JOIN departamento AS c<br>
INNER JOIN tipo_doc AS d<br>
INNER JOIN unidade as e<br>
INNER JOIN perfil_doc as f<br>
WHERE a.nro_caixa = $numero
What happens is that the bank is looking for infinitely. When I limited the query to 20 results I noticed that it is picking up some repeated values and not picking up others.