Use Sublime text, Mysql Workbench and Xampp.
I made an inner join in the select below, in a table called Organizacoes.Copia. In this table there is a field called "id" and I need it to appear in this Php code.
I saw several videos and examples, and I could not do it. How do I put it to pull the copy of those returning clients in my variable " $result
"? How do I include this in the while?
Here's the code ready:
<?php
$servidor = '****';
$user = '****';
$senha = '****';
$banco = 'Organizacoes';
// Cria conexão
$conn = new mysqli($servidor, $user, $senha, $banco);
// Checa conexão
if ($conn->connect_error) {
die("Conexão falha: " . $conn->connect_error);
}
$sql = "SELECT Org.id
,Org.nome
FROM Organizacoes as Org
INNER JOIN Organizacoes.Rel_Organizacoes as Grupo on Org.id = Grupo.id_Organizacao
INNER JOIN Organizacoes.Copias as Copia on Org.id = Copia.id_Organizacao
WHERE Grupo.id_grupo = 210
GROUP BY Org.id
ORDER BY Org.id";
$result = $conn->query($sql);
echo " <tr>";
if ($result->num_rows > 0) {
// dados de saída de cada linha
while($row = $result->fetch_assoc()) {
echo "id: " . $row["id"]. " - nome: " . $row["nome"]. " " . "<br>";
}
} else {
echo "0 results";
}
$conn->close();
?>