Bardzo prosze o pomoc.
Mam wyszukiwarkę w bazie zdjęć. Chcę ją udoskonalić, bo wyszukuje tylko po tagach, a chcę zeby wyszukiwała równiez po opisie/tytule.

Funkcja wyglada tak:
  1. function search() {
  2. $perpage = 18;
  3. if (!empty($_POST["tag"]) && $_POST["tag"] != 'false') {
  4. $tagId = intval($this -> asfoto -> getTagId(trim(urldecode($_POST["tag"])), false));
  5.  
  6. if ($tagId > 0) {
  7. $this->db->from('af_tag_fotografia');
  8. $this->db->where("af_tag_fotografia.Tag_Id", $tagId);
  9. $this->db->join("af_fotografie", "af_fotografie.Foto_Id = af_tag_fotografia.Foto_Id");
  10. $this->db->select('Count(af_fotografie.Foto_Id) as Ilosc');
  11. $this->db->where("af_fotografie.Foto_Status", 'A');
  12. $query = $this->db->get();
  13. if ($query -> num_rows == 1) {
  14. $result = $query->result();
  15. $Foto_Num = $result[0]->Ilosc;
  16. }
  17.  
  18.  
  19.  
  20. $this->db->from('af_tag_fotografia');
  21. $this->db->where("af_tag_fotografia.Tag_Id", $tagId);
  22. $this->db->where("af_fotografie.Foto_Status", 'A');
  23. $this->db->join("af_fotografie", "af_fotografie.Foto_Id = af_tag_fotografia.Foto_Id");
  24. $this->db->select('*');
  25. $this->db->order_by("Foto_".$_POST["sortBy"], $_POST["sortMethod"]);
  26. }
  27.  
  28. }
  29. else {
  30. $this->db->from('af_fotografie');
  31. $this->db->order_by("Foto_".$_POST["sortBy"], $_POST["sortMethod"]);
  32. $this->db->where("af_fotografie.Foto_Status", 'A');
  33. $this->db->select('Count(Foto_Id) as Ilosc');
  34. $query = $this->db->get();
  35. if ($query -> num_rows == 1) {
  36. $result = $query->result();
  37. $Foto_Num = $result[0]->Ilosc;
  38. }
  39.  
  40.  
  41. $this->db->from('af_fotografie');
  42. $this->db->where("af_fotografie.Foto_Status", 'A');
  43. $this->db->order_by("Foto_".$_POST["sortBy"], $_POST["sortMethod"]);
  44. $this->db->select('*');
  45. }
  46. $this -> db -> limit($perpage,$perpage*$_POST["page"]);
  47. $query = $this->db->get();
  48. if ($query -> num_rows > 0) {
  49. foreach($query->result() as $photo) {
  50. $arrPhotos["photos"][] = (array)$photo;
  51. }
  52. }
  53. $arrPhotos["num"] = $Foto_Num;
  54. $arrPhotos["curpage"] = $_POST['page'];
  55. $arrPhotos["pages"] = ceil($Foto_Num/$perpage);
  56. echo json_encode($arrPhotos);
  57. }
  58.  
  59. function view($photoId) {
  60. $arrVars["arrPhoto"] = $arrPhoto = $this -> asfoto -> getInformation($photoId);
  61. $arrVars["inView"] = "Photos_View";
  62. $this->load->view('layout', $arrVars);
  63. }
  64.  
  65. function search_foto() {
  66.  
  67. $arrVars["inView"] = "Photos_Index";
  68. $arrVars["query"] = $_POST["query"];
  69. $this->load->view('layout', $arrVars);
  70. }


Dodam, ze tabele w bazie są rozne dla tagow rozne dla fotografii (gdzie są opisy/tytuly zdjęć)
tagi są w tabeli af_tagi, a opisy w as_fotografie.

Czy ktos pomoże mi uzupełnić powyższą funkcję, aby w wynikach wyszukiwania bramka pod uwagę również opisy/tytuły z tabeli as_fotografie?


To może ktoś przeniesie ten temat do działu php? Nikt nie wie jak mi pomoc?