Person, I am new to the Forum I would like to ask for the first help. To summarize: I am developing a call system, where it joins data from other systems.
I would like to display all data from 2 sql tables in a php tab, every row exists information from a table.
- table 1
- table 2
- table 1
- table 2
I only found information about join, but that would not help me because it joins the data in the same column, and I would like separate rows for each table in the database.
I'm doing this:
<?php
$servidor = "localhost"; /*maquina a qual o banco de dados está*/
$banco = "xxxx"; /*seleciona o banco a ser usado*/
$usuario = "root"; /*usuario do banco de dados MySql*/
$senha = ""; /*senha do banco de dados MySql*/
$conexao = mysql_connect($servidor,$usuario,$senha);
/*Conecta no bando de dados MySql*/
mysql_select_db($banco);
/*seleciona o banco a ser usado*/
$res = mysql_query("SELECT * FROM base_itg, base_spn");
/*Executa o comando SQL, no caso para pegar todos os chamados e retorna o valor da consulta em uma variavel ($res) */
?>
and then put on the screen
while($escrever=mysql_fetch_array($res)){
$id = $escrever['id']; /*Escreve cada linha da tabela*/
echo "<tr>
<td> <a href = 'detalhe.php?id=$id' target =_blank>" . $escrever["bl_situacao"] . "</td>
<td>" . $escrever["bi_sistema"] . "</td>
<td>" . $escrever["bl_local_atendimento"] . "</td>
<td>" . $escrever["bl_uf"] . "</td>
<td>" . $escrever["bl_chamado"] . "</td>
<td>" . $escrever["bl_criado_em"] . "</td>
<td>" . $escrever["bl_resumo"] . "</td>
</tr>";
echo "<tr>
<td> <a href = 'pages/detalhados/spn.php?id=$id' target =_blank>" . $escrever["bs_status"] . "</td>
<td>" . $escrever["bs_sistema"] . "</td>
<td>" . $escrever["bs_sistema"] . "</td>
<td>" . $escrever["bs_sistema"] . "</td>
<td>" . $escrever["bs_sistema"] . "</td>
<td>" . $escrever["bs_sistema"] . "</td>
<td>" . $escrever["bs_sistema"] . "</td>
</tr>";
}/*Fim do while*/
I can show the data simultaneously, but with an error, it gets duplicated.
If adding the data of the two tables I have 4 items, it shows 8.