Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2014
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. function category_search($category) {
  2. $this -> db -> select('a.id, a.artist_fname, a.artist_lname, b.artist_id, b.sm_file_name, b.category_id, b.category_id2, b.category_id3, c.id, c.category');
  3. $this -> db -> from('ap_mini_artist a', 'ap_mini_artwork b', 'ap_art_categories c', 'ap_art_categories c2', 'ap_art_categories c3');
  4. $this -> db -> where('c.category', $category, 'after');
  5. $this -> db -> join('ap_mini_artwork b', 'b.artist_id=a.id', 'left');
  6. $this -> db -> join('ap_art_categories c', 'c.id=b.category_id', 'left');
  7. $this -> db -> join('ap_art_categories c2', 'c2.id=b.category_id2', 'left');
  8. $this -> db -> join('ap_art_categories c3', 'c3.id=b.category_id3', 'left');
  9. $query = $this -> db -> get();
  10. return $query -> result();
  11. }
  12.  
  13. public function category_search() {
  14.  
  15. $category = $this -> input -> post('categoryValue');
  16. $query = $this -> mini_show_model -> category_search($category);
  17.  
  18. if (!empty($query)) {
  19. $json = json_encode($query);
  20. print $json;
  21. } else {
  22. echo "Your query is empty, please try again.";
  23.  
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement