Error when using include

1

I have two php files that return a echo with a table. They work ok.

PregnantChased.php

echo '<h2>Gestantes Cadastradas</h2>';
echo '<table class="table table-striped">';
echo '<tr><th style="text-align:center;">Unidade</th><th style="text-align:center;">Gestante</th><th style="text-align:center;">Competência</th></tr>';

$total = 0;
$totalPrazo = 0;
while ($row = pg_fetch_assoc($result)) {
  if ($row['diferenca'] > 0){
    echo "<tr style='background-color:red; color:white'><td>".$row['nu_cnes']." - ".$row['unidade']."</td><td>".$row['nome']."</td><td>".str_pad($row['mes'], 2, "0", STR_PAD_LEFT)."/".$row['ano']."</td></tr>";
    $totalPrazo ++;
  }else{
    echo "<tr><td>".$row['nu_cnes']." - ".$row['unidade']."</td><td>".$row['nome']."</td><td>".str_pad($row['mes'], 2, "0", STR_PAD_LEFT)."/".$row['ano']."</td></tr>";
  }
  $total ++;
}

echo "<tr><td colspan='2'>TOTAL DE GESTANTES CADASTRADAS</td><td>".$total."</td></tr>";
echo "<tr><td colspan='2'>TOTAL DE GESTANTES CADASTRADAS INDEVIDAMENTE</td><td>".$totalPrazo."</td></tr>";
echo '</table>';

PregnantApproved.php

echo '<h2>Gestantes Acompanhadas pelo ACS</h2>';
echo '<table class="table table-striped">';
echo '<tr><th style="text-align:center;">Unidade</th><th style="text-align:center;">Gestante</th><th style="text-align:center;">Competência</th></tr>';

$total = 0;
while ($row = pg_fetch_assoc($result)) {
  echo "<tr><td>".$row['nu_cnes']." - ".$row['no_equipe']."</td><td>".$row['no_cidadao']."</td><td>".$row['count']."</td></tr>";
  $total += $row['count'];
}

echo "<tr><td colspan='2'>TOTAL DE GESTANTES ACOMPANHADAS</td><td>".$total."</td></tr>";
echo '</table>';

And I have a index.php file that calls them both like this:

include 'functions/gestanteCadastrada.php';
include 'functions/gestanteAcompanhada.php';

Everything works fine, however, what I want is for the pregnant file Filename.php to call the pregnant file .compile.php like this:

include 'gestanteAcompanhada.php?gestanteCadastrada='.$total;
//veja que ele acrescenta uma variável à url

But I'm getting file error not found:

  

Warning: include <

And the file is in the correct place. What can it be?

    
asked by anonymous 26.01.2018 / 16:22

1 answer

1

From what I understand, you can not give an include passing parameters. When you give an include it looks for a file on the server and does not run it as if it were on the web. So, you will not find a file called "pregnant.pattern.php? Pregnant.patterned = 8".

Edit: You can resolve your case with sessions, or even calling the file as a service.

    
26.01.2018 / 18:16