bcit-ci / CodeIgniter

Open Source PHP Framework (originally from EllisLab)
https://codeigniter.com/
MIT License
18.27k stars 7.6k forks source link

PHP Parse Error '=' #2606

Closed za closed 11 years ago

za commented 11 years ago

Hello,

I am trying to follow the code igniter tutorial. It's the news section[1]. When I tried to run it, it failed.

The apache error log shows:

PHP Parse error:  syntax error, unexpected '=' in /var/www/ci/application/models/news_model.php on line 18

Line 18 is:

query = $this->db->get_where('news', array('slug' => $slug));

What caused this problem? I am using codeigniter 2.1.4 and PHP 5.3.6

[1]http://ellislab.com/codeigniter/user-guide/tutorial/news_section.html

tkaw220 commented 11 years ago

The error message indicates your problem very clearly, you missed the $ sign before the variable query.

$query = $this->db->get_where('news', array('slug' => $slug));
za commented 11 years ago

Hrrr.... my bad.

@tkaw220 thank you!