-1
I choose the car maker, the model, engine and year and perform the consultation so:
$query = "SELECT b.montadora, m.modelo, n.motor, a.ano, d.descricao, c.combustivel, f.f_cabine, g.local_ar_cabine, h.f_ar, j.f_lub_princ, k.f_lub_opcional, l.f_combustivel FROM 13_tecfil t
JOIN 0_montadora b
ON t.montadora = b.id
JOIN 1_modelo m
ON t.modelo = m.id
JOIN 2_motor n
ON t.motor = n.id
JOIN 3_ano a
ON t.ano = a.id
JOIN 4_descricao d
ON t.descricao = d.id
JOIN 5_combustivel c
ON t.combustivel = c.id
JOIN 6_f_cabine f
ON t.f_cabine = f.id
JOIN 7_local_ar_cabine g
ON t.local_ar_cabine = g.id
JOIN 8_f_ar h
ON t.f_ar = h.id
JOIN 9_f_lub_princ j
ON t.f_lub_princ = j.id
JOIN 10_f_lub_opcional k
ON t.f_lub_opcional = k.id
JOIN 11_f_combustivel l
ON t.f_combustivel = l.id
WHERE t.montadora = '". $_POST['id_montadora'] ."' AND
t.modelo = '". $_POST['id_modelo'] ."' AND
t.motor = '". $_POST['id_motor'] ."' AND
t.ano = '". $_POST['id_ano'] ."'
ORDER BY b.montadora";
$result_query = mysqli_query($conn, $query);
However, there are cars that query returns data and have cars that returns NULL. The case is that if I reduce the query to just appear the indexes so:
$query = "SELECT * FROM 13_tecfil
WHERE montadora = '". $_POST['id_montadora'] ."' AND
modelo = '". $_POST['id_modelo'] ."' AND
motor = '". $_POST['id_motor'] ."' AND
ano = '". $_POST['id_ano'] ."'
ORDER BY montadora";
$result_query = mysqli_query($conn, $query);
The cars that before returned nothing, returns data now, despite being only indexes. Is there any JOIN restriction in PHP? How can I make the first query work?
*Thanks, I didn’t know those limits! *It is strange that the keys are not working, I saw by BD and it looks OK, besides it is a problem in some queries, others work... *Yes, the ID column of each table is present in 13_tecfil. *Ok, I’ll try another mode...
– Nosredna