how to solve "Cannot modify header information - headers already sent by" eroor in php
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1793482/php-error-cannot-modify-header-information-headers-already-sent">PHP error: Cannot modify header information – headers already sent</a><br>
  <a href="http://stackoverflow.com/questions/8028957/warning-headers-already-sent-in-php">“Warning: Headers already sent” in PHP</a>  </p>
</blockquote>



<p>I many times used header('location:index.php')..but each time it
        give me error like " Cannot modify header information - headers
        already sent by"..plz anybody help me....</p>

<pre><code>&lt;?PHP
    $exist=mysql_query("select * from lease where pro_id='".$pro_id."'")
    or die(mysql_error());
    if(mysql_num_rows($exist)&gt;0){header('location:leaseexist.php');} ?&gt;
</code></pre>

<p>UPDATE </p>

<p>the error is </p>

<blockquote>
<pre><code>Warning: Cannot modify header information - headers already sent by (output started at
</code></pre>
  
  <p>/home/content/39/9845539/html/slwebsite/leaseprofile.php:15) in
  /home/content/39/9845539/html/slwebsite/leaseprofile.php on line 19</p>
</blockquote>

<p>and line 19 is</p>

<pre><code> if(mysql_num_rows($exist)&gt;0){header('location:leaseexist.php');}
</code></pre>
