problem in printing month of date |
[eluser]Unknown[/eluser]
model Code: function articledate() Code: <?php controller Code: $this->data['articled'] = $this->Home_model->articledate(); but i dont know how to print the result in view can anyone help me??? thanks in advance.....
[eluser]jmadsen[/eluser]
You will need to use a column alias for your field, and then do your $row->articledate using the alias name so: Code: SELECT DISTINCT MONTH(articledate) AS articledate FROM articles
[eluser]Anonymous[/eluser]
First hit on google: Code: function ConvertDate($sql_date) { try to make a helper with this function
[eluser]jmadsen[/eluser]
his query was fine - might as well do it on the db like he is and bring back less data. he just needed to know how to access computed fields.
[eluser]Unknown[/eluser]
now my code running fine and i am getting results like this july 2011 june 2011 ... now i want to convert july 2011 into 72011 and june 2011 to 62011 can anyone help me? thanks in advance......
[eluser]jmadsen[/eluser]
How can you be getting "Month Year" if you are only asking for MONTH in your query? "SELECT DISTINCT MONTH(articledate)" Have a look at this, and read your Manual about in Mysql & Php http://ellislab.com/forums/viewthread/191776/ |
Welcome Guest, Not a member yet? Register Sign In |