0
I started a Session and performed an SQL search
<?
session_start();
$_SESSION['modulo'] = "WebSocialSocial/";
$_SESSION['root'] = substr(__FILE__, 0, strpos(__FILE__, substr($_SESSION["modulo"], 0,-1)));
$_SESSION['linkroot'] = "http://".$_SERVER['HTTP_HOST'].substr($_SERVER['REQUEST_URI'], 0, strpos($_SERVER['REQUEST_URI'], $_SESSION['modulo']));
$_SESSION['comum'] = "WebSocialComum/";
require_once $_SESSION['root'] . $_SESSION['comum'].'class/commonClass.php';
$common = new commonClass();
echo $common->incJquery();
$sqlLogon = "SELECT uni_codigo, esp_codigo FROM logon WHERE id_login = '" . $_SESSION['usr_codigo'] . "' ORDER BY id DESC LIMIT 1";
//die($sqlLogon);
$queryLogon = pg_query($sqlLogon);
?>
if you die this is the result of the query : SELECT uni_codigo, esp_codigo FROM logon WHERE id_login = '649' ORDER BY id DESC LIMIT 1
, which by its made returns the unit code and the specialty . What I really care about is the unit code.
Next I have an HTML that will be printed :
<html xmlns="http://www.w3.org/1999/xhtml" lang="pt" xml:lang="pt">
<head>
<link href='<?= $this->baseUrl('/public/css/paisagem-print.css') ?>' rel='stylesheet' type='text/css'></link>
<script type="text/javascript">
var baseUrl = '<?= $this->baseUrl(); ?>';
$(function () {
window.print();
});
</script>
<?= $this->headScript() . "\n"; ?>
<?= $this->analytics(); ?>
<style type="text/css">
#imagemFundo{
background-image: url('/public/images/creas.png');
background-repeat: no-repeat;
background-size: cover;
width: 800px;
height: 120px;
}
</style>
</head>
<body>
<div id="page">
<!--CABEÇALHO-->
<div class="cabecalho">
<div class="brasao">
</div>
<div class="dados_cabecalho">
<?
while ($req = pg_fetch_array($queryLogon)) {
if ($req['uni_codigo'] == 22) {
echo "ola mundo";
}
}
?>
</div>
<div class="cod_bar">
<div id="img_bar">
</div>
</div>
</div>
<div id="titulo_impressao"><b><?= $this->tipo_impressao; ?></b></div>
<!--FIM DO CABEÇALHO-->
<!--CONTEÚDO-->
<?= $this->layout()->content; ?>
<!--FIM DO CONTEÚDO-->
<!--RODAPE -->
<div id="footer">
<div id="assinatura">
<table width='100%' cellspacing=0 cellpadding=0 border=0>
<tr>
<td>
_____________________________<br/>
<b>Responsável:</b>
</td>
<td>
_____________________________<br/>
<b>Assistente Social:</b>
<td>
</tr>
</table>
</div>
<div id="endereco">
<?= $this->secretaria->endereco_secretaria ?>,
<?= $this->secretaria->numero_end_secretaria ?>,
<?= $this->secretaria->sec_bairro ?>,
TELEFONE:<?= $this->secretaria->telefone_secretaria ?>
</div>
</div>
<!--fim do rodapé-->
</div>
</body>
</html>
But it’s like while doesn’t even exist ,the whole page is loaded minus while . I made some syntax or logic error ?
I tried to make these changes even though I haven’t had results yet .
– Lucas Alves
And one thing the connection is not required correct ? for example I did not pass the Connection it will use the last call of the page is not ? or spoke nonsense .
– Lucas Alves
Thank you very much, I found the problem really p_query recovers the last session but I had not informed correctly . Problem solved.
– Lucas Alves