0
I’m having a hard time retrieving information.
In the data for printing, I need to show in the variable $comp
when she belongs to the same id_cadastro
that I am consulting, so far everything well, worked out, but I have several $comp
for the same id_cadastro
, to $comp
is equal to consultation d_comp
bank, and in some cases I have up to 10 $comp
, I’m trying to show you when to ($comp
for =1 show the d_comp
1) concerning the id_cadastro
of the query, when the variable $volume
is equal to $comp = 1 show its value.
Then I get the $comp 2 and successively.
I’ve tried to if
, not of the expected value, I’m here with the while
but it won’t go.
Follow the code below:
<?php require_once("logica_usuario.php");
verificaUsuario();
require_once('forms_funcoes.php');
$id = $_GET['id'];
$imp = impLaudos($conexao, $id);
?>
<body onLoad="javascript:window.print();">
<table width="1411" height="1889" border="0" bordercolorlight="#FC0004" >
<tbody>
<tr>
<td height="29"> </td>
<td colspan="5"><?=$imp['cadEquip']?></td>
<td> </td>
<td> </td>
<td colspan="6"><?=$imp['cadInmetro']?></td>
<td colspan="9"><?=$imp['cadCapaci']?></td>
<td colspan="6"><?=$imp['cadMarca']?></td>
</tr>
<tr>
<td height="30"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
//daqui para baixo
<td colspan="2">
<?php
//$comp = compartimento
$comp = $imp['d_comp'];
$i = 1;
while($i == $comp){
echo $comp;
$i++;
}
?></td>
<td colspan="2">
<?php
if($comp == 2){
echo $comp;
} else {
echo "";
}
?>
</td>
<td>
<?php
if($comp == 3){
echo $comp;
} else {
echo "";
}
?>
</td>
<td colspan="3">
<?php
if($comp == 4){
echo $comp;
} else {
echo "";
}
?>
</td>
<td colspan="2">
<?php
if($comp == 5){
echo $comp;
} else {
echo "";
}
?>
</td>
</tr>
here is the function impLaudo
:
function impLaudos($conexao, $id){
$query = "select desco.*,
cli.cli_nome as nomeCli,
cli.cli_cnpj as cnpjCli,
cad.condutor as cadCondutor,
cad.condutor_cpf as cadCondutor_cpf,
cad.placa as cadPlaca,
cad.id_cli,
cad.data as cadData,
cad.id as cadId,
cad.marca_modelo as cadMarcaModelo,
cad.chassi as cadChassi,
cad.equipamento as cadEquip,
cad.num_imetro as cadInmetro,
cad.capacidade as cadCapaci,
cad.marca as cadMarca,
cad.id_fin as cadFinalidade,
cad.id_proc as cadProcesso
from descontaminacao as desco
left join cadastro as cad on cad.id = desco.id_cadastro
left join cliente as cli on cli.id = cad.id_cli
where desco.id = {$id}";
$resultado = mysqli_query($conexao, $query);
return mysqli_fetch_assoc($resultado);
}
The table register is where the customer and other data is, and the id of this table is in the table decontamination which in turn will have up to 10 register for the same registration id, and in printing this report I need to define to which data $d_comp
when equal to 1, show the data of the d_comp = 1
the decontamination table, the id x of the registration table and when the $d_comp
is equal to 2 show data from d_comp
of the same id x of the registration table.
@Andreicoelho will be able to help me in this too?
– Junior Venancio