0
I have a site where I do an SQL that returns the records and the amount of records I need to show on the site. For some reason that does not come to question, I no longer have the possibility to capture this variable before header.
I have to put the data in parentheses that are at the top of the site.
This result returns to me through a $_POST['enviar']
the result of SQL and the amount of records that are already inserted below the header. How to put the amount of records in this "Results()"?
The code below shows well what I’m trying to do: get the $qteRegistros
and pull it up.
<?php
echo $qteRegistros; <--------------------
$qteRegistros = "380";
?>
I didn’t understand the doubt, you want to print the variable value before assigning?
– abfurlan
The code is executed in the sequence in which it is written. Change the last two place lines.
– Oralista de Sistemas
I can’t change places. Since PHP is ultra fantastic, I want to know if it does. Something to do with
global
????– Marcos Vinicius
Why Cause, Reason, Reason or Circumstance Can You Not Change The Place Lines? Oo
– Oralista de Sistemas
I do an SQL and return the amount of records and need to show the amount of records there at the top of the site !!!
– Marcos Vinicius
http://answall.com/help/mcve
– Maniero
@Marcosvinicius Then run SQL before drawing the top of the site.
– bfavaretto
You’re trying to kill before you shoot... forget it! the only way I see it would be to move the value to the right location using css or javascript...
– Jader A. Wagner
I’ll help you understand how Sopt works. It’s simple, it’s like at school. It’s not the teacher who gives the grade, it’s the student who gets the grade. The student does what he has to do, if he if help, the teacher recognizes this. Here the user makes the question stay in a state that you can answer, everyone who can will be happy to help. But you simply cannot answer what is not understandable. After all the help already received here, you cannot say that there is bad will. It’s simply still impossible to help anymore. Do yourself a favor, help us help you.
– Maniero
It is reopened, but for a more precise answer you need to include the code snippet that draws what is in the image.
– bfavaretto
In short, you need to save all the html in a variable, to the point where you want to use the
$qteRegistros
. Only from there you can start issuing the output. PHP has a buffer that can help with this.– bfavaretto
You want to print a variable that doesn’t exist - that’s a logic problem. I think you should give more information, preferably the code you have.
– Papa Charlie
I just wanted to capture a variable after it was ready and @Jader gave me exactly the hint I needed to get my problem solved. I did this by capturing the variable after ready with jQuery and playing it where I needed it. Jader, feel free to come up with an answer for me to evaluate.
– Marcos Vinicius
I removed my -1. Finally the real doubt appeared... Funny that the first version of the question had
Surgiu essa dúvida que deve ser super simples.
, and as it turned out, simple had nothing :P– brasofilo