Unknown column 'sitename' in 'where clause' public function getSiteValues($value) {
    $this-&gt;db-&gt;select(
        'site', 
        'id, option_name, option_value', 
        NULL, 
        'option_name=' . $value
    ); // database, what to take, where value 
    $res = $this-&gt;db-&gt;getResult();

    echo '&lt;pre&gt;';
    print_r($res);
    echo '&lt;/pre&gt;';
}


In this case I would like to put for example: 

getSiteValues('sitename')


and so that this would return the value of sitename row and from option_value column, but it keep giving me error such as 

[0] =&gt; Unknown column 'sitename' in 'where clause'


What can I do to fix this? 

PS. I have tried to look at other solutions but they have keep giving me wrong solutions. I have tried most of them. btw I am using this crud library - https://github.com/rorystandley/MySQL-CRUD-PHP-OOP for db connections
Sitename is a string, but you're not enclosing it in apostrophes, so SQL is interpreting it as a column. Please try adjusting like so:

"option_name='" . $value . "'"