diff --git a/application/controllers/Search.php b/application/controllers/Search.php index b7d1b0d3..6ee1a4d5 100644 --- a/application/controllers/Search.php +++ b/application/controllers/Search.php @@ -120,15 +120,14 @@ class Search extends CI_Controller { $this->search_filter->delete_query($id); } - function edit_query() { + function save_edited_query() { $data = array( - 'cat' => xss_clean($this->input->post('category')), - 'title' => xss_clean($this->input->post('title')), - 'note' => xss_clean($this->input->post('content')) + 'description' => xss_clean($this->input->post('description')), ); $this->db->where('id', xss_clean($this->input->post('id'))); - $this->db->update('notes', $data); + $this->db->where('userid', $this->session->userdata['user_id']); + $this->db->update('queries', $data); } function fetchQueryResult($json, $returnquery) { diff --git a/application/migrations/079_add_queries_table.php b/application/migrations/079_add_queries_table.php index 8403f0eb..a1f90889 100644 --- a/application/migrations/079_add_queries_table.php +++ b/application/migrations/079_add_queries_table.php @@ -4,7 +4,7 @@ class Migration_add_queries_table extends CI_Migration { public function up() { - $this->db->query("create table queries (id integer not null auto_increment, query text, description text, userid integer not null, primary key (id)) ENGINE=myisam DEFAULT CHARSET=utf8;"); + $this->db->query("create table if not exists queries (id integer not null auto_increment, query text, description text, userid integer not null, primary key (id)) ENGINE=myisam DEFAULT CHARSET=utf8;"); } public function down() diff --git a/application/views/interface_assets/footer.php b/application/views/interface_assets/footer.php index 476fab7e..fdf77110 100644 --- a/application/views/interface_assets/footer.php +++ b/application/views/interface_assets/footer.php @@ -52,289 +52,320 @@ function load_was_map() { uri->segment(1) == "search" && $this->uri->segment(2) == "filter") { ?> - + diff --git a/application/views/search/stored_queries.php b/application/views/search/stored_queries.php index a0de4018..5f1e9494 100644 --- a/application/views/search/stored_queries.php +++ b/application/views/search/stored_queries.php @@ -13,15 +13,15 @@ $i = 1; id . '">'; - echo '' . $i++ . ''; - echo '' . $q->description . ''; - echo '' . $q->query . ''; - echo 'Edit'; - echo 'Delete'; - echo ''; - } + foreach ($result as $q) { + echo ''; + echo '' . $i++ . ''; + echo '' . $q->description . ''; + echo '' . $q->query . ''; + echo 'Edit'; + echo 'Delete'; + echo ''; + } ?> - + \ No newline at end of file