title: PHP error help on while loop
body: <p>I can't figure out how to resolve a PHP error. </p>
  
  <p>On the code below I receive the error:</p>
  
  <p>Fatal error: Cannot redeclare getintro() (previously declared ... on line 94) </p>
  
  <p>I marked line 94 below. Any help or guidance is appreciated. My goal is to loop out each blog post based on each row of the database with only a portion of the text showing. When the link it clicked, it should open the full blog with comments in blog.php</p>
  
  <pre><code>    &lt;?php   // retreive post
       include('php/config.php');
      include ('php/function.php');
      dbConnect();
  
      $blog_query = mysql_query(
      'SELECT * 
      FROM Blog
      ORDER BY DATE DESC');
  
      while($row = mysql_fetch_array($blog_query)):
  
      $date = date_create($row['DATE']);
      $str = $row['CONTENT'];
      $ID = $row['ID'];
  
  LINE 94    function getIntro($str, $count = 200) {
          return preg_replace('/\s+?(\S+)?$/', '', substr(nl2br($str), 0, $count)) . "   &lt;a href=\"blog.php?page={$ID}\" class=\"changeColor\"&gt;Read more...&lt;/a&gt;\n";
          }
          $new_string = getIntro($str);
      ?&gt;
  
      &lt;div class="post"&gt;
          &lt;h2&gt;&lt;?php echo $row['TITLE']?&gt;&lt;/h2&gt;
          &lt;h3&gt;&lt;?php echo date_format($date, 'l, F j, Y')?&gt;&lt;/h3&gt;
          &lt;p&gt;&lt;?php echo $new_string?&gt;&lt;/p&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;      
  &lt;?php endwhile?&gt;    
  </code></pre>