Jump to content

Serach engine not working in multi languag..


Tauheed
 Share

Recommended Posts

Dear Experts, i have created a arabic to persian to english dictionary, whenever i will enter english keyword to search box it will show the result, but when i will type persian and arabic word in box it will show zeero result, actually i have saved alots of arabic and persian words in my databse. i have saved all file using encoding "UTF-8". i dont know where i need to change. both pages source codes are mentioned below. please help me i will be thankful for this kindness. index.php <html><head><link rel="stylesheet" type="text/css" href="style.css" /><title>Dictionary</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><script type="text/javascript" src="ajax.js"></script><script type="text/javascript"> function getScriptPage(div_id,content_id,get_count){subject_id = div_id;content = document.getElementById(content_id).value;http.open("GET", "script_page.php?content=" + escape(content)+"&count="+get_count, true);http.onreadystatechange = handleHttpResponse;http.send(null);} </script><link href="styles.css" rel="stylesheet" type="text/css"></link></head> <body><div class="ajax-div"><div class="input-div">Enter Search Keyword here :<input type="text" id="text_content" size="40" onKeyUp="getScriptPage('count_display','text_content','1')"><input type="button" class="button" value="Search" onMouseUp="getScriptPage('output_div','text_content','0')"><div id="count_display"> </div></div><div class="output-div-container"><div id="output_div"></div></div></form></div></body></html> script_page.php <link rel="stylesheet" type="text/css" href="style.css" /><?php// You can do anything with the data. Just think of the possibilities!include('conn.php'); $strlen = strlen($_GET['content']);$display_count = $_GET['count']; $select = "select * from dic where (english like '%".$_GET['content']."%') or (arabic like '%".$_GET['content']."%') or (persian like '%".$_GET['content']."%')";$res = mysql_query($select);$rec_count = mysql_num_rows($res); if($display_count){echo "There are <font color='red' size='3'>".$rec_count."</font> matching records found.Click Search to view result.";}else{?> <center> <table class="sofT" cellspacing="0" border="1"><tr><td colspan="5" class="helpHed" align="center">Search Result</td></tr><tr> <td class='helpHed'>English</td> <td class='helpHed'>Arabic</td> <td class='helpHed'>Arabic Roman</td> <td class='helpHed'>Persian</td> <td class='helpHed'>Persian Romant</td> </tr><?phpif($rec_count > 0){while($data=mysql_fetch_array($res)){echo "<tr><td class='sup'>".$data['english']."</td><td class='sup'>".$data['arabic']."</td><td class='sup'>".$data['aroman']."</td><td class='sup'>".$data['persian']."</td><td class='sup'>".$data['proman']."</td> </tr>";}}elseecho '<td colspan="5" align="center"><FONT SIZE="2" COLOR="red">No matching records found....!</FONT></td>'; }?></center>

Edited by Tauheed
Link to comment
Share on other sites

Like I said, the first thing to do is to print out the query so you can see what you're telling the database to do. You can use a tool like phpMyAdmin to run the query and check the results, and change the query if necessary to get the results you're looking for. That's how you diagnose what the problem is. If UTF encoding is a problem then you can try to either encode or decode the values you're adding to the query. You should also verify that the table you're searching is storing data using UTF, you can see that information in phpMyAdmin also.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...