{"id":22,"date":"2009-06-14T09:25:00","date_gmt":"2009-06-14T09:25:00","guid":{"rendered":"http:\/\/www.codeboss.in\/web-funda\/?p=22"},"modified":"2009-06-14T09:25:00","modified_gmt":"2009-06-14T09:25:00","slug":"write-mysql-database-query-in-magento","status":"publish","type":"post","link":"https:\/\/codeboss.in\/web-funda\/2009\/06\/14\/write-mysql-database-query-in-magento\/","title":{"rendered":"Write MySQL Database Query in Magento"},"content":{"rendered":"<p>If you need to execute a MySQL query anywhere in Magento (in the .php code files or .phtml template files), the following steps are required &#8211;<\/p>\n<pre class=\"brush: php;\">\n$conn = Mage::getSingleton('core\/resource')->getConnection('core_write');\n$conn->query(\"insert into table name (fields) values (values) \");\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>If you need to execute a MySQL query anywhere in Magento (in the .php code files or .phtml template files), the following steps are required &#8211; $conn = Mage::getSingleton(&#8216;core\/resource&#8217;)->getConnection(&#8216;core_write&#8217;); $conn->query(&#8220;insert into table name (fields) values (values) &#8220;);<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[54,57],"class_list":["post-22","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-magento","tag-php","entry"],"_links":{"self":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/22","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/comments?post=22"}],"version-history":[{"count":0,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/posts\/22\/revisions"}],"wp:attachment":[{"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/media?parent=22"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/categories?post=22"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codeboss.in\/web-funda\/wp-json\/wp\/v2\/tags?post=22"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}