Good afternoon, guys. I have a problem that I no longer know how to solve.
I have the following mysql query in php:
mysql_select_db("banco", $conexao);
$resultado = mysql_query("SELECT * FROM pessoa WHERE id = '" . $cod . "'");
while ($linha = mysql_fetch_array($resultado))
This works.
But I need to get the data from another table referenced in the person table. The person table has a foreign keyed column of the vehicle table.
If I put the sql below in PhpMyAdmin to test, it works:
SELECT p.id, p.nome, v.modelo FROM pessoa p
INNER JOIN veiculo v ON p.veiculo = v.id
WHERE p.id = 17
Now if I get this sql and put it in php it gives error:
mysql_select_db("banco", $conexao);
$resultado = mysql_query("SELECT p.id, p.nome, v.modelo FROM pessoa p INNER JOIN veiculo v ON p.veiculo = v.id WHERE p.id = '" . $cod . "'");
while ($linha = mysql_fetch_array($resultado))
This has already consumed my day! What can I be wrong?