php - Parse error: syntax error, unexpected ';', expecting identifier (T_STRING) or variable (T_VARIABLE) -


i have problem code. (i've looked solution didn't found anything, thats why i'm posting topic)

error:

parse error: syntax error, unexpected ';', expecting identifier (t_string) or variable (t_variable) or '{' or '$' in xxxxxx on line 13 

line 13:

echo $view->;htmlerror(); 

my code:

<?php require_once 'classes/view.php';  echo db_hostname; //output: hostname  $view = new view();  if ($htmlstring = $view->tablethreads()) {     echo $htmlstring; } else {     echo $view->;htmlerror(); }  echo $view->buttonpostthread(); ?> 

view.php

// need class db make object require_once 'database.php';  //we'll need recaptcha helper later require_once 'helpers/recaptcha.php';  class view{      private $db;      function __construct()     {         $this->db = new database();     }      function tablethreads()     {         $content = "";          if (($threads = $this->db->getthreads()) && mysql_num_rows($threads) > 0) {              $content .= '<h1>threads</h1>';              $content .= '<table border="0" width="" id="posts_list">';              $content .= '<tr>';              $content .= '<th class="title">title</td>';              $content .= '<th>date</td>';              $content .= '<th>user</td>';              $content .= '</tr>';              while ($row = mysql_fetch_assoc($threads)) {                 $content .= '<tr class="thread">';                 $content .= '<td class="title">';                 $content .= '<a href="view_thread.php?permalink=';                 $content .= htmlspecialchars($row['permalink']) . '">'.$row['title'].'</a>';                 $content .= '</td>';                 $content .= '<td class="date">'.htmlspecialchars($row['date']).'</td>';                 $content .= '<td class="author">'.htmlspecialchars($row['author']).'</td>';                 $content .= '</tr>';             }             $content .= '</table>';             return $content;         } else {             return false;         }     }  private function composetable($post, $firstpost, $numrows) {     $htmltable = "";      if ($firstpost)         $htmltable .= '<h1>'.htmlspecialchars($post['title']).'</h1>';      $htmltable .= '<table border="0" width="895">';     $htmltable .= ' <tr>';     $htmltable .= '     <th>message</th>';     $htmltable .= '     <th>date</th>';     $htmltable .= '     <th>author</th>';     $htmltable .= ' </tr>';     $htmltable .= ' <tr>';     $htmltable .= '     <td class="title">'.htmlspecialchars($post['content']).'</td>';     $htmltable .= '     <td class="date">'.htmlspecialchars($post['date']).'</td>';     $htmltable .= '     <td class="author">'.htmlspecialchars($post['author']).'</td>';     $htmltable .= ' </tr>';     $htmltable .= '</table>';     if ($firstpost && $numrows &gt; 1)         $htmltable .= '<h1>responses</h1>';      return $htmltable; }  function tablethreadcontent($permalink) {     $content = "";      if ($posts = $this->db->getcontentthread($permalink)) {         $num_rows = mysql_num_rows($posts);         if ($num_rows > 0) {             while($row = mysql_fetch_assoc($posts))                 $content .= $this->composetable($row,                     is_null($row['permalink_parent']),                     $num_rows);         }         return $content;     } else {         return false;  //database error     } }  [/html]  <p>the second method goes around posts in thread , composes html first 1 (composetable). </p>  <p>the method composetable private because we'll call tablethreadcontent method in same class , functionality useful inside class. in future if want make class extends 1 , uses method need change private protected.</p>  <p>now let's think happens if don't have single thread. apart being sad problem if don't show warning message. simple method that:</p>  function htmlerror($from_view_thread = false) {     if ($from_view_thread) {         //from view_thread.php         $html = '<p class="error">there no thread title. sorry! ';         $html .= 'you can go <a href="index.php">the main page</a>.</p>';     }else{         // index.php         $html = '<p class="error">there aren\'t threads. sorry! </p>';     }     return $html; }  function buttonpostthread() {     return '<div class="newthread">'           .'<a href="post_message.php">create new thread</a>'           .'</div>'; } 

you need correct line:

echo $view->;htmlerror(); 

to:

echo $view->htmlerror(); 

for rest, please check code.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -