如果来自同一页面的另一个请求,如何已经加载由服务器处理的PHP脚本

I real beginner and try to understand how things work more then to develop stuff, and now i can't move forward till someone gives me an accurate answer about a little detail of following issue.

Let's assume there's a page with php code http://example.com/blablabla and link on it like http://example.com/blablabla?file=number_1 which's used to modify some parts of this page What i really don't know is what happens with the already loaded script from http://example.com/blablabla when there's a request from this page -http://example.com/blablabla?file=number_1

The questions actually are: Is code from the already loaded page processed every time when requesting ?file=number_1? For me it seems very strange, 'cause if with the first http://example.com/blablabla via php i selected for example a huge size of data from database and only want to modify small part of page with ?file=number_1 and why do i need server to process request to the database one more time.

My experience says me that server do process again already loaded code, BUT according to this i have a very SLIGHT ASSUMPTION, that i'm not really sure about this, but it seems very logical:

The real trick is that the code in the first page has one VARIABLE and its value is changed by the second request, so i assume that server see this change and modifies only that part of the code with this VARIABLE - for example the code in http://example.com/blablabla looks like this

<? 

 /* some code above */

if (empty($_GET['file'])) {
/* do smth */
} else {
/* do smth else */
} 

 /* some code below */

?>

with the request http://example.com/blablabla?file=number_1 the server processes only part of the original code only including changed $_GET['file'] variable.

Is it totally my imagination or it somehow make a point? Would someone please explain it to me. Much appreciated.

HTML is a static language. There is php and other similar languages that allows you to have dynamic pages but because it still has to send everything over as html you still have to get a new page.

The ?file=number_1 just gives a get request to the page giving it more information but the page itself had to still be rerun in order to change the information and send the new static html page back.

The database query can be cached with more advanced programming in PHP or other similar languages so that the server doesnt have to requery the database but the page itself still had to be completely rerun

There are more advanced methods that allows client side manipulation of the data but from your example I believe the page is being rerun with a get request on the server side and a new page is being sent back.

i believe this is what your asking about.

Yeah, thanks you guys both. It certainly clarified the issue that every script (clean html or generated by php) runs every time with each request, and only external types of data like image files and, even as it follows from the previous answer, mysql results can be cached and be used via php to output necessary data.

The main point was that I mistakenly hoped that if the page is loaded and consequently cached in computer memory, the appended QUERY STRING to this URL will send, of course, new get request, but retrieved respond will affect this page partly without rerunning it completely.
Now i have to reconsider my building strategy – load as much data as it’s required from each requested URL.

If you are looking for a way to edit the page dynamically, use JavaScript. If you need to run code server side, invisibly to the client, use PHP. If you need to load content dynamically, use AJAX, an extension of JavaScript.

I hope that helps.