Mystery 500 error
<p>This may be a n00b question, but I cannot for the life of me figure out what I'm screwing up. I've had a similar problem before but I think I fixed it more by accident than design, and I'd really like to know what I'm actually doing wrong.</p>

<p>I get a 500 error if I run the code in the pastebin. However, if I comment out the display_wine function it runs perfectly fine. If I run the debugger it just highlights the closing php tag. I've checked and double checked to make sure I didn't have any additional brackets or semicolons. Any help would be greatly appreciated! </p>

<pre><code>&lt;?php

class simpleCMS {

  var $host;
  var $username;
  var $password;
  var $table;
  var $id;


  public function display_wine_list() {
    $q = "SELECT * FROM whino ORDER BY created DESC LIMIT 3";
    $r = mysql_query($q);

    if ( $r !== false &amp;&amp; mysql_num_rows($r) &gt; 0 ) {
      while ( $a = mysql_fetch_assoc($r) ) {
        $id = $a['id'];
        $name = stripslashes($a['name']);
        $created = $a['created'];
        $type = $a['type'];

        /**
        $evalt = "require_once '../generator/qrlib.php';";
        eval($evalt);
        QRcode::png('http://qr.htbx.net/simplecms/mob_display.php?id='.$id, '../generator/temp/'.$id.'.png');
        **/

        $entry_display .= &lt;&lt;&lt;ENTRY_DISPLAY

    &lt;div class="post"&gt;
        &lt;h2&gt;
            $name
        &lt;/h2&gt;
        &lt;p&gt;$created&lt;/p&gt;
        &lt;p&gt;$type&lt;/p&gt;

    &lt;/div&gt;

ENTRY_DISPLAY;
      }
    } else {
      $entry_display = &lt;&lt;&lt;ENTRY_DISPLAY

    &lt;h2&gt; This Page Is Under Construction &lt;/h2&gt;
    &lt;p&gt;
      No entries have been made on this page. 
      Please check back soon, or click the
      link below to add an entry!
    &lt;/p&gt;

ENTRY_DISPLAY;
    }
    $entry_display .= &lt;&lt;&lt;ADMIN_OPTION

    &lt;p class="admin_link"&gt;
      &lt;a href="{$_SERVER['PHP_SELF']}?admin=1"&gt;Add a New Entry&lt;/a&gt;
    &lt;/p&gt;

ADMIN_OPTION;

    return $entry_display;
  }

  public function display_admin() {
    return &lt;&lt;&lt;ADMIN_FORM

    &lt;form action="{$_SERVER['PHP_SELF']}" method="post"&gt;

      &lt;label for="name"&gt;Name:&lt;/label&gt;&lt;br /&gt;
      &lt;input name="name" id="name" type="text" maxlength="75" /&gt;
      &lt;div class="clear"&gt;&lt;/div&gt;

      &lt;label for="type"&gt;Type:&lt;/label&gt;&lt;br /&gt;
      &lt;input name="type" id="type" type="text" maxlength="100" /&gt;
      &lt;div class="clear"&gt;&lt;/div&gt;

      &lt;label for="notes"&gt;Notes:&lt;/label&gt;&lt;br /&gt;
      &lt;textarea name="notes" id="notes"&gt;&lt;/textarea&gt;
      &lt;div class="clear"&gt;&lt;/div&gt;

      &lt;input type="submit" value="Create This Entry!" /&gt;
    &lt;/form&gt;

    &lt;br /&gt;

    &lt;a href="display.php"&gt;Back to Home&lt;/a&gt;

ADMIN_FORM;
  }

  public function write($p) {
     if ( $_POST['name'] )
      $name = mysql_real_escape_string($_POST['name']);
    if ( $_POST['type'])
      $type = mysql_real_escape_string($_POST['type']);
    if ( $_POST['grapes'])
      $grapes = mysql_real_escape_string($_POST['grapes']);
    if ( $_POST['notes'])
      $notes = mysql_real_escape_string($_POST['notes']);
    if ( $name &amp;&amp; $type &amp;&amp; $grapes &amp;&amp; $notes ) {
      $created = date ("Y-m-d H:i:s", $phptime);
      $sql = "INSERT INTO whino VALUES('','$name','$type','$grapes', '$notes')";
      return mysql_query($sql);
    } else {
      return false;
    }
 }

  public function connect() {
    mysql_connect($this-&gt;host,$this-&gt;username,$this-&gt;password) or die("Could not connect. " . mysql_error());
    mysql_select_db($this-&gt;table) or die("Could not select database. " . mysql_error());

    return $this-&gt;buildDB();
  }

  private function buildDB() {
    $sql = &lt;&lt;&lt;MySQL_QUERY
CREATE TABLE IF NOT EXISTS whino (
id          INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
name        VARCHAR(75),
notes       TEXT,
created     DATE,
type        VARCHAR(100),
grapes      VARCHAR(75)
)
MySQL_QUERY;

    return mysql_query($sql);
  }

 public function display_wine($id) {
    $q = "SELECT * FROM whino WHERE id = $id";
    $r = mysql_query($q);

    if ( $r !== false &amp;&amp; mysql_num_rows($r) &gt; 0 ) {
        while ( $a = mysql_fetch_assoc($r) ) {
            $id = $a['id'];
        $name = stripslashes($a['name']);
        $created = $a['created'];
        $type = $a['type'];

        $entry_display .= &lt;&lt;&lt;ENTRY_DISPLAY

            &lt;div class="post"&gt;
                &lt;h2&gt;
                    $name
                &lt;/h2&gt;
                &lt;p&gt;$created&lt;/p&gt;
                &lt;p&gt;$type&lt;/p&gt;

            &lt;/div&gt;

        ENTRY_DISPLAY;
        }
    } else {
        $entry_display = &lt;&lt;&lt;ENTRY_DISPLAY

        &lt;h2&gt; This Page Is Under Construction &lt;/h2&gt;
        &lt;p&gt;
        No entries have been made on this page. 
        Please check back soon, or click the
        link below to add an entry!
        &lt;/p&gt;

        ENTRY_DISPLAY;
    }
    $entry_display .= &lt;&lt;&lt;ADMIN_OPTION

    &lt;p class="admin_link"&gt;
    &lt;a href="{$_SERVER['PHP_SELF']}?admin=1"&gt;Edit&lt;/a&gt;
    &lt;/p&gt;

    ADMIN_OPTION;

    return $entry_display;
  } 


}

?&gt;
</code></pre>
