w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Understanding cache limiter | headers already sent php warning

Something somewhere before session start and session regenerate id is putting something on the page. If you are sure you're not echoing or printing anything to the page, it's probably a blank space at the top of one of the files.

EDIT 1

Some text editors/word processors save files with extra invisible characters at the top due to encoding. Try copying and pasting the text of the files into new files in a plain text editor or text editor recommended for coding, such as Notepad++.

EDIT 2

So, those were the most likely solutions.... It says

output started at
/home2/mysite/public_html/mysubsite/index_3.php:7

which means that it's line 7 of index_3.php where the output starts at. There is probably a space there or maybe some kind of error that causes output to be sent.

If you really can't find that invisible output, you can use buffering with ob_start etc. to catch all output. Put ob_start before your session start and use ob_end_flush later to display the page. But that's not a real fix for the fact that you're sending output without knowing it.

EDIT 3: "No output" includes any and all HTML.

If there's something in any file that is not inside PHP brackets <?php ?> then that counts. Your index_3.php file starts with HTML. That is output. You have to do get_opwire.php first.

EDIT 4

Concerning how get_opwire.php has both page-start stuff and the table printout, it's an example of why it's a good idea to separate your display code from your functionality code. You have three options:

  1. Have separate files. You would have a file like page_start.php that does includes and session_start that you include at the very top of index_3.php, and a file like display_table.php that displays your table that you include where the table goes.
  2. Turn the table into a function. You would wrap the table output inside a function, include get_opwire.php at the very top of index_3.php, then call the function down where you want the table.
  3. Use output buffering. Output buffering catches the stuff printed out so that you can use it later. It would go like this:

top of index_3.php:

 ob_start();
 include get_opwire.php;
 $table = ob_get_contents();
 ob_end_clean();

where the table goes:

 echo $table; 




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.