Hi guys, - in index.php, i included another file, that is included.php include "included.php"; PHP: - this is the included.php file content, its including another file too, that is included2.php include "included2.php"; $name = echo "$list->hospital['room']"; PHP: - i only need a variable value that already printed & processed in included.php, that is people name, and just get the name printed value in index.php, without including included2.php file too, maybe processing included2.php just need to stop in included.php file please help how to do that guys i already tried add return; in the last included.php file line, but looks like still not works
remove "echo" from $name variable and on your index.php use: echo $name; Anyway maybe i missunderstand this if yes than make better description of what you need.
thank you for the reply, but its not what i need. current index.php file already can print name value, but its looks like also get the whole included2.php file content, so too big to execute, i just need the name value, without the entire included2.php file content
So you want stop including included2.php file on the index.php ? Whats content on the included2.php file ? past it here.
yes like that included2.php file is the script configuration file, that connected to the database, the size is very big 180kb, this is the problem i just need to get the printed name value that already a text, for example : john, that should be only 0.00000001 kb
If you include files, all of their content will, naturally, br included. Hence you get access to everything. If the size of the included file exceeds some sort of filesize limit or execution time, there's something very wrong with the design of the site.
Well if you stop including the file which holds your database connection how you would than fetch those results from your database ? You want something which is really unpossible. Your file will never be 1kb
Why in God's name does the script configuration take up 180kb? You do not pull everything from db once, you pull what's needed when it's needed. But, assign the value to a session variable , and use that to pull what's needed.
the name value already printed when i open included.php in address bar, for example john, is there methode to catch/fetch that text john into index.php? if using assign the value to a session variable, please give tutorial link if any
teehee what do you mean, thank you for replying, liked your post & PoPSiCLe btw i get 1 more methode, using file_get_contents, in index.php i try use this $name = file_get_contents("http://www.domain.com/included.php"); PHP: the result, i get the text value, but its just showing text 0, because the server that fetch the included.php file, not client computer, still thinking if there other methode or tricks tried this in included.php too include "included2.php"; $name = echo "$list->hospital['room']"; if ($_REQUEST['do'] == 'test') { echo $list->hospital['room']; } PHP: and use include this in index.php file include "save2.php?do=useridwc2"; PHP: still not works, still requesting the entire included2.php file
Okay this madness has to stop. I'm sorry to tell you this, but your code is a disaster. You're hacking solutions into your code that are hard to maintain and even harder to work with. How about this: You create a new file that includes a function that gets/returns the data you want to put into your site. functions.php: function getName() { /* Do whatever you need to do to get this data */ return $list->hospital['room']; } PHP: ... then in index.php: require_once 'path/to/functions.php'; $name = getName(); echo $name; PHP: ... and then you just call the function whenever you need the name.