get_where to PDO

Asked

Viewed 32 times

0

I want to change get_where to mysql or PDO, but I don’t know! Help ...!

public function get_where($table = '', $where = NULL, $limit = NULL, $offset = NULL)
{
    if ($table !== '')
    {
        $this->from($table);
    }

    if ($where !== NULL)
    {
        $this->where($where);
    }

    if ( ! empty($limit))
    {
        $this->limit($limit, $offset);
    }

    $result = $this->query($this->_compile_select());
    $this->_reset_select();
    return $result;
}

I need help to change:

$this->db->get_where('settings' , array('type' => 'site_name'))->row()->description;

for PDO.

I changed the following information in the database

Table: Settings;

type => option_name;

site_name => title

Description => option_value

  • What you know about SQL?

  • In theory (Obs: describing how it works) nothing, but in practice I turn to thirty and it ends up working a lot, but the question itself is not relevant in question of the published subject. Anyway, could you help me?

  • I even tried to risk putting like this: $db->query('SELECT option_value FROM Settings WHERE array("option_name" => "title") DESC'); however, it did not work

  • There seems to be some more settings in this class, only with this code there is no way to know. Some error appears?

  • 1

    The SQL syntax is independent of PHP and is entirely relevant to the question. Start by reading the basics of the language before trying to do anything. Remember that working is not the same as being right. Maybe this will get you started: link

  • Um, well, you could set me up with $db->query('SELECT option_value FROM Settings WHERE array("option_name" => "title") DESC');

  • That’s some kind of framework?

  • is not a framework

Show 3 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.