title: Issue with the debugging in php
body: <p>I am running a<code>php</code>script which have a
  while loop and file writings which make it take some time.The problem comes when it doesn 't seems to print the errors at the run time it prints them after complete execution of the script, and sometimes error is in loop so it repeat every time with loop  and it cost me a lot of time. I am using Wamp Server Version 2.2 .
  <br>
  here is sample <code>code</code></p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Algorithm" content="text/html; charset=utf-8" /&gt;
  &lt;title&gt;Delta Compression&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;?php
  //DB Connection
  $dbuser = "root";
  $dbpass = "";
  $dbname = "delta_compression";
  $dbhost = "localhost";
  
  //Database Connection
  $con = mysql_connect($dbhost,$dbuser,$dbpass);
  if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
  
  mysql_select_db($dbname, $con);
  echo "Database Connected !";
  
  //Variable declaration 
  $file="flag_track.txt";
  $result=mysql_query("select * from d_5");
  $total_rows=mysql_num_rows($result);
  $limit=256;
  
  while($i &lt; $total_rows){
      //increasing time limit 
      set_time_limit(0);
      //getting the value from the row of reading
      $reading=mysql_result($result,$i,'reading');
      //if first flag is set 
          if(!(firstFlag())) {
              delta();
              }
      //convert the decimal to binary and store in db 
      if(saveDelta(decbin($diffrence))== flase){
          echo"Error saving the data in DB";
  
          }   
  
  }
  function delta(){
  
          $delta=$flag-$reading;
          file_put_contents ($file, $flag."&lt;br&gt;".$delta, FILE_APPEND)."&lt;br&gt;";             
          if( $delta &gt; $limit){
                  $flag=$reading;
                  file_put_contents ($file, $flag."&lt;br/&gt;".$delta,     FILE_APPEND)."&lt;br&gt;";
  
                  }
  }
  
  function firstFlag(){
  if($flag == null){
          //set the flag
          $flag=$reading;
          //saving the flag 
          file_put_contents ($file, $flag, FILE_APPEND)."&lt;br&gt;";
          return true;
          }
          else {
  
  return false;
  }
  }
  
  
  function saveDelta($dif) {
  
  if(mysql_query("INSERT INTO e_x_1 (delta_of_reading) VALUES ('b" . $dif . "')")){
  return true; //on success
  } else {
  return false; //on failure
  }
  
  }
  ?&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>