{"id":1627,"date":"2022-08-30T15:18:06","date_gmt":"2022-08-30T15:18:06","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/11\/27\/mysql-funtions-with-kohana-orm-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:18:06","modified_gmt":"2022-08-30T15:18:06","slug":"mysql-funtions-with-kohana-orm-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/mysql-funtions-with-kohana-orm-collection-of-common-programming-errors\/","title":{"rendered":"MySql funtions with kohana ORM-Collection of common programming errors"},"content":{"rendered":"<p>i m bit confuse how to convert my query :<\/p>\n<pre><code>&gt; SELECT COUNT(`id`) AS `total_logs`, `userlog`.* FROM `user_log` AS\n&gt; `userlog` WHERE `user_id` = '31' AND date(`date_created`) =\n&gt; '2012-04-30'\n<\/code><\/pre>\n<p>to Kohana 3.1 ORM? currently i m using :<\/p>\n<pre><code>&gt; $isLoged = ORM::factory('Userlog')-&gt;select(array('COUNT(\"id\")',\n&gt; 'total_logs'))\n&gt;                 -&gt;where('user_id', '=', $user-&gt;id)\n&gt;                 -&gt;and_where('Date(date_created)', '=',  date('Y-m-d'))\n&gt;                 -&gt;find_all();\n<\/code><\/pre>\n<p>unfortunately above one is giving error \ud83d\ude41<\/p>\n<blockquote>\n<p>Database_Exception [ 1054 ]: Unknown column &#8216;Date(date_created)&#8217; in &#8216;where cla&#8230;.<\/p>\n<\/blockquote>\n<p id=\"rop\"><small>Originally posted 2013-11-27 12:09:31. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>i m bit confuse how to convert my query : &gt; SELECT COUNT(`id`) AS `total_logs`, `userlog`.* FROM `user_log` AS &gt; `userlog` WHERE `user_id` = &#8217;31&#8217; AND date(`date_created`) = &gt; &#8216;2012-04-30&#8217; to Kohana 3.1 ORM? currently i m using : &gt; $isLoged = ORM::factory(&#8216;Userlog&#8217;)-&gt;select(array(&#8216;COUNT(&#8220;id&#8221;)&#8217;, &gt; &#8216;total_logs&#8217;)) &gt; -&gt;where(&#8216;user_id&#8217;, &#8216;=&#8217;, $user-&gt;id) &gt; -&gt;and_where(&#8216;Date(date_created)&#8217;, &#8216;=&#8217;, date(&#8216;Y-m-d&#8217;)) &gt; -&gt;find_all(); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1627","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=1627"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/1627\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=1627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=1627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=1627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}