dayname(curdate()) NOT working in codeigniter php

This sql works in phpmyadmin but not working in codeigniter php

function getProgramsHomepage(){
    $data = array();
    $this->db->select("p_name,p_start");
    $this->db->where('p_channel', 'tv');
    $this->db->where('p_day', DAYNAME(CURDATE()));
    $this->db->order_by('id','asc');
    //$this->db->limit($limit);
    $Q = $this->db->get('programs');
    if($Q->num_rows() > 0){
        foreach($Q->result_array() as $row){
            $data[] = $row;
        }
    }
    $Q->free_result();
    return $data;
}

Answers


DAYNAME(CURDATE()) will try to execute the PHP functions CURDATE and DAYNAME, you need to pass them as strings in a way that CI will not escape. This should do it:

$this->db->where('p_day = DAYNAME(CURDATE())');

Need Your Help

Is there a good introductory tutorial for Yahoo! User Interface?

yui

Does anyone know of a good tutorial for developers who are taking their first look at the Yahoo User Interface? The one on Yahoo's site is not very good, and I can't find a different one.

Java: IndentingXMLStreamWriter alternative?

java xml indentation stax

I am using StAX to create a quite large xml document. Until now I was using the IndentingXMLStreamwriter class to get a well formatted document (see also this answer). A few days ago we setup a jen...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.