解决语法错误(意外标识符)时遇到问题

时间:2019-04-06 01:19:57

标签: php codeigniter

我正在尝试为我的项目构建评论系统。我在解决语法错误时遇到了麻烦。错误详情如下:

语法错误  意外:标识符“ li_comment_”  after:字符串'“,},',',OR,XOR,&&,?,;,||,&&,|,^,&,==,!=,===,!==,<=, > =,<=>,<,>,<<,>>,+,-,*,/,%,'。',[,],),:,??

可能的语法错误(检查前面的有效语法错误)  意外:{

可能的语法错误(检查前面的有效语法错误)

意外:}

 function add_blog_comment() {
        if (isset($_POST) && isset($_POST['comment_text'])) {
            $name = $_POST['comment_name'];
            $blog_id = $_POST['content_id'];
            $parent_id = $_POST['reply_id'];
            $comment_text = $_POST['comment_text'];
            $email = $_POST['comment_email'];
            $web = $_POST['comment_web'];
            $data = array(
                'comment_text' => $comment_text,
                'parent_id' => $parent_id,
                'ip_address' => $this->input->ip_address(),
                'email_address' => $email,
                'web_address' => $web,
                'created_date' => date('Y-m-d h:i:sa'),
                'created_by' => $name,
                'blog_blog_id' => $blog_id
            );
            $resp = $this->blog->add_blog_comment($data);
            if ($resp != NULL) {
                foreach ($resp as $row) {
                    $date = mysql_to_php_date($row->created_date);
                    echo "<li id="li_comment_{$row->comment_id}">" .
                    "<div><span class="commenter">{$row->created_by}</span>&nbsp;<span class="comment_date">{$date}</span></div>" .
                    "<div style="margin-top:4px;">{$row->comment_text}</div>" .
                    "<a href="#" class="reply_button" id="{$row->comment_id}">reply</a>" .
                    "</li>";
                }
            } else {
                echo 'Error in adding comment';
            }
        } else {
            echo 'Error: Please enter your comment';
        }
    }

}
```strong text

0 个答案:

没有答案