Parse Error Syntax Error Unexpected T_string Expecting T_variable Codeigniter
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About syntax error unexpected this Us Learn more about Stack Overflow the company Business Learn more about hiring syntax error unexpected '$this' (t_variable) developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the
Unexpected '' (t_encapsed_and_whitespace)
Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Codeigniter: Why am i getting this
Parse Error: Syntax Error, Unexpected (t_variable)
error,“ unexpected '(', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' ”? [duplicate] up vote -1 down vote favorite This question already has an answer here: PHP Parse/Syntax Errors; and How to solve them? 10 answers Parse error: syntax error, unexpected '(', expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in C:\wamp\www\ghostwriter\application\models\addproject_m.php on line 117 I am trying to create a pagination php for my page, so i created a function to fetch the counts of the projects. function get_projects_count(){ $this->db->select->('p_id')->from('ghost_projects'); $query=$this->db->get(); return $query->num_rows(); } The above code is in the model. $this->data['projects'] = $this->addproject_m->ongoingprojects(5,$start); $this->load->library('pagination'); $config['base_url'] = base_url().'project/search'; $config['total_rows'] = $this->addproject_m->get_projects_count(); $config['per_page'] = 5; $this->pagination->initialize($config); $data['pages']=$this->pagination->create_links(); And the above code is from the controller. Can somebody please help me on this erro i am facing (new to codeigniter). php codeigniter share|improve this question edited Sep 2 '15 at 7:43 Saty 17.9k51733 asked Sep 2 '15 at 7:31 david noronha 151112 marked as duplicate by John Condephp Users with the php badge can single-handedly close php questions as duplicates and reopen them as needed. Sep 2 '15 at 11:40 This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. add a comment| 2 Answers 2 active oldest votes up vote 1 down vote accepted The problem is in 1 extra '->' that should not be there: $this->db->select->('p_id')->from('ghost_projects'); //right here $this->db->select('p_id')->from('ghost_projects'); //this is what it should be The error tells you that you cannot have '(' after -> which makes sense since you have to e
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like http://stackoverflow.com/questions/32347070/codeigniter-why-am-i-getting-this-error-unexpected-expecting-identifier you, helping each other. Join them; it only takes a minute: Sign up Parse error: syntax error, unexpected '<', expecting T_STRING or T_VARIABLE [closed] up vote -1 down vote favorite I am creating Helloworld in PHP by following the tutorials given in net.tutsplus.com/tutorials/. Following is the controller code which is creating the error: http://stackoverflow.com/questions/12132189/parse-error-syntax-error-unexpected-expecting-t-string-or-t-variable Controller{ function index() { $this->load->model('helloworld_model'); $data['result'] = $this->helloworld_model->getData(); $data['page_title'] = "CI Hello World App!"; $this->load->view('helloworld_view',$data); } } ?> Any help? php codeigniter share|improve this question asked Aug 26 '12 at 17:12 Arun 1952923 closed as too localized by casperOne Aug 27 '12 at 18:10 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question. Ok, this is from a tutorial that many people read, so cannot be localized –ed-ta Mar 5 '15 at 2:02 add a comment| 1 Answer 1 active oldest votes up vote 1 down vote There was a rendering error on the page you visited. An HTML tag was being displayed when it sh
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss http://stackoverflow.com/questions/18050071/php-parse-syntax-errors-and-how-to-solve-them the workings and policies of this site About Us Learn more about http://forum.codeigniter.com/thread-55363.html Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each syntax error other. Join them; it only takes a minute: Sign up PHP Parse/Syntax Errors; and How to solve them? up vote 206 down vote favorite 108 Everyone runs into syntax errors. Even experienced programmers make typos. For newcomers it's just part of the learning process. However, it's often easy to interpret error messages such as: PHP Parse error: syntax error, syntax error unexpected unexpected '{' in index.php on line 20 The unexpected symbol isn't always the real culprit. But the line number gives a rough idea where to start looking. Always look at the code context. The syntax mistake often hides in the mentioned or in previous code lines. Compare your code against syntax examples from the manual. While not every case matches the other. Yet there are some general steps to solve syntax mistakes. This references summarized the common pitfalls: Unexpected T_STRING Unexpected T_VARIABLE Unexpected '$varname' (T_VARIABLE) Unexpected T_CONSTANT_ENCAPSED_STRING Unexpected T_ENCAPSED_AND_WHITESPACE Unexpected $end Unexpected T_FUNCTION… Unexpected { Unexpected } Unexpected ( Unexpected ) Unexpected [ Unexpected ] Unexpected T_IF Unexpected T_FOREACH Unexpected T_FOR Unexpected T_WHILE Unexpected T_DO Unexpected T_PRINT Unexpected T_ECHO Unexpected T_INLINE_HTML… Unexpected T_PAAMAYIM_NEKUDOTAYIM… Unexpected T_OBJECT_OPERATOR… Unexpected T_DOUBLE_ARROW… Unexpected T_SL… Unexpected T_BOOLEAN_OR… Unexpected T_BOOLEAN_AND… Unexpected T_IS_EQUAL Unexpected T_IS_GREATER_OR_EQUAL Unexpected T_IS_IDENTICAL Unexpected T_IS_NOT_EQUAL Unexpected T_IS_NOT_IDENTICAL Unexpected T_IS_SMALLER_OR_EQUAL Unexpected < Unexpected > Unexpected T_NS_SEPARATOR… Unexpected character in input: '\' (ASCII=92) state=1 Unexpected 'public' (T_PUBLIC) Unexpected 'private' (T_PRIVATE) Unexpected 'protected' (T_PROTECTED) Unexpected 'final' (T_FINAL)… Unexpected T_STATIC… Unexpected
error: syntax error, unexpected 'function_construct' (T_STRING), expecting variable (T_VARIABLE) in C:wampwwwframe Thread Closed 0 Vote(s) - 0 Average 1 2 3 4 5 Thread Modes Parse error: syntax error, unexpected 'function_construct' (T_STRING), expecting variable (T_VARIABLE) in C:wampwwwframe El Forum Unregistered #1 10-23-2012, 02:33 AM [eluser]Dario[/eluser] Hi! I just started using CodeIgniter and to get to know with the system i started writing the tutorial that comes with it. Was very entusiastic until i tried to view my news page . the error i get is Parse error: syntax error, unexpected 'function_construct' (T_STRING), expecting variable (T_VARIABLE) in C:\wamp\www\framework\application\controllers\news.php on line 5. This is the code Code:
class News extends CI_Controller {
public function_construct()
{
parent::_construct();
$this->load->model('news_model');
}
public function index()
{
$data['news'] = $this->news_model->get_news();
}
public function view($slug)
{
$data['news'] = $this->news_model->get_news($slug);
}
public function index()
{
$data['news'] = $this->news_model->get_news();
$data['title'] = 'News archive';
$this->load->view('templates/header',$data);
$this->load->view('news/index',$data);
$this->load->view('templates/footer');
}
public function view($slug)
{
$data['news_item'] = $this->news_model->get_news($slug);
if (empty($data['news_item']))
{
show_404();
}
$data['title'] = $data['news_item']['title'];
$this->load->view('templates/header',$data);
$this->load->view('news/view',$data);
$this->load->view('templates/footer');
}
} Thank you!! El Forum Unregistered #2 10-23-2012, 02:35 AM [eluser]Aken[/eluser] It tells you exactly what the error is, and what line it's on. Look at that