{"id":171,"date":"2012-06-29T22:23:31","date_gmt":"2012-06-29T20:23:31","guid":{"rendered":"http:\/\/my-opinions.info\/?p=171"},"modified":"2014-09-07T10:01:46","modified_gmt":"2014-09-07T08:01:46","slug":"vlozhenyj-zapros-v-codeignator","status":"publish","type":"post","link":"https:\/\/uw-t.com\/en\/codeigniter\/vlozhenyj-zapros-v-codeignator","title":{"rendered":"\u0412\u043b\u043e\u0436\u0435\u043d\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 codeignator"},"content":{"rendered":"<p>\u041a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u0430\u043b\u043e \u0432\u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430, \u0441\u0440\u0430\u0437\u0443 \u043a\u043e\u0434, \u043d\u0438\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u043d\u0435\u043c\u0443<\/p>\n<pre lang=\"PHP\" line=\"1\">\n    $this->db->select(\"*\")\n            ->from(\"schedule\")\n            ->order_by(\"schedule.dayofweek\", \"asc\")\n            ->order_by(\"schedule.lesson_number\", \"asc\")\n            ->order_by(\"date_approve\", \"desc\");\n    $s = $this->db->_compile_select();\n    $this->db->_reset_select();\n    $dbprefix = $this->db->dbprefix;\n    $this->db->set_dbprefix('');\n    $this->db->select(\"*\")\n            ->from('(' . $s . ') as ' . $this->db->dbprefix . 'schedule_tmp');\n\n    $this->db->set_dbprefix($dbprefix);\n    $this->db->join(\"lessons\", \"lessons.lesson_id = schedule_tmp.lesson_id\", \"left\")\n            ->join(\"students\", \"schedule_tmp.class_id = students.class_id\")\n            ->where(\"schedule_tmp.class_id\", $class_id)\n            ->where(\"schedule_tmp.date_approve <\", \"2012-06-29 14:59:00\")\n            ->group_by(\"schedule_tmp.dayofweek, schedule_tmp.lesson_number\");\n    $query = $this->db->get();\n\n\n    return $query->result();\n<\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441<\/p>\n<pre lang=\"SQL\" line=\"1\">\n      SELECT * FROM (\n      SELECT * FROM `uw_schedule` ORDER BY  `uw_schedule`.`dayofweek` ASC, `uw_schedule`.`lesson_number` ASC, `uw_schedule`.`date_approve` DESC\n      ) as uw_schedule_tmp\n\n      LEFT JOIN `uw_lessons` ON `uw_lessons`.`lesson_id` = `uw_schedule_tmp`.`lesson_id`\n      LEFT JOIN `uw_students` ON `uw_schedule_tmp`.`class_id` = `uw_students`.`class_id`\n      WHERE `uw_schedule_tmp`.`class_id` = 0\n      AND `uw_schedule_tmp`.`date_approve` < '2012-06-29 14:59:00'\n      GROUP BY uw_schedule_tmp.dayofweek, uw_schedule_tmp.lesson_number\n<\/pre>\n<p>\u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u044b \u0441\u0442\u043e\u043b\u043a\u043d\u0435\u0442\u0435\u0441\u044c \u0441 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u043e\u0439 \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434\u044b<br \/>\n_compile_select();<br \/>\n_reset_select();<br \/>\nprotected, \u0430 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0441\u0430, \u0447\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f \u043d\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0430\u043b\u0441\u044f \u043a\u0430\u043a \u043e\u0431\u043e\u0439\u0442\u0438 \u044d\u0442\u0443 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e \u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u043b \u0438\u0445 \u0432 \u044f\u0434\u0440\u0435 \u043d\u0430 public, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u0442\u0441\u044f, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430, \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044e \u0441\u0442\u0430\u0442\u044c\u044e, \u0438 \u0441\u0435\u0431\u0435 \u043d\u0430 \u0437\u0430\u043c\u0435\u0442\u043a\u0443.. )<\/p>\n<p>\u0418 \u0442\u0430\u043a \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e \u043a\u043e\u0434\u0443,<br \/>\n$this->db->dbprefix \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043f\u0440\u0435\u0444\u0438\u043a\u0441, \u0435\u0441\u043b\u0438 \u0412\u0430\u043c \u043e\u043d \u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430<br \/>\n_compile_select() \u0412\u043e\u0437\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u0430\u043f\u0440\u043e\u0441 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u0443\u044e<br \/>\n_reset_select(); <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u0430\u043a \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u0430\u043b\u043e \u0432\u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430, \u0441\u0440\u0430\u0437\u0443 \u043a\u043e\u0434, \u043d\u0438\u0436\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043f\u043e \u043d\u0435\u043c\u0443 $this->db->select(\"*\") ->from(\"schedule\") ->order_by(\"schedule.dayofweek\", \"asc\") ->order_by(\"schedule.lesson_number\", \"asc\") ->order_by(\"date_approve\", \"desc\"); $s = $this->db->_compile_select(); $this->db->_reset_select(); $dbprefix = $this->db->dbprefix; $this->db->set_dbprefix(''); $this->db->select(\"*\") ->from('(' . $s . ') as ' . $this->db->dbprefix . 'schedule_tmp'); $this->db->set_dbprefix($dbprefix); $this->db->join(\"lessons\", \"lessons.lesson_id = schedule_tmp.lesson_id\", \"left\") ->join(\"students\", \"schedule_tmp.class_id = students.class_id\") ->where(\"schedule_tmp.class_id\", $class_id) ->where(\"schedule_tmp.date_approve<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[22],"tags":[],"class_list":["post-171","post","type-post","status-publish","format-standard","hentry","category-codeigniter"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/uw-t.com\/en\/wp-json\/wp\/v2\/posts\/171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/uw-t.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/uw-t.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/uw-t.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/uw-t.com\/en\/wp-json\/wp\/v2\/comments?post=171"}],"version-history":[{"count":6,"href":"https:\/\/uw-t.com\/en\/wp-json\/wp\/v2\/posts\/171\/revisions"}],"predecessor-version":[{"id":259,"href":"https:\/\/uw-t.com\/en\/wp-json\/wp\/v2\/posts\/171\/revisions\/259"}],"wp:attachment":[{"href":"https:\/\/uw-t.com\/en\/wp-json\/wp\/v2\/media?parent=171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/uw-t.com\/en\/wp-json\/wp\/v2\/categories?post=171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/uw-t.com\/en\/wp-json\/wp\/v2\/tags?post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}