In codeigniter 404 page not found when database error occurred. When I try to fetch data from MySQL using Hebrew character in where clause.
My code is:
<?php $uri_segment=end($this->uri->segments); $se_query=$this->db->query("SELECT * FROM tours WHERE tour_slug='".$uri_segment."'"); $sec_data=$se_query->result_array(); ?>
My URL is:
http://example.com/tour-details/מופע-פלמנקו
How can I fetch data using Hebrew character in where clause, which Hebrew character get from URL.
You need to use this code urldecode($uri_segment);
For example:
<?php $uri_segment1=end($this->uri->segments); $uri_segment=urldecode($uri_segment1); //echo $uri_segment; $raw_query=$this->db->query("SELECT * FROM tbl_tours WHERE tour_slug='".$uri_segment."'"); $sec_data=$raw_query->result_array(); ?>
Output: SELECT * FROM tours WHERE tour_slug=’שלום’
Question and answer is powered by AnsPress.io