Help me with SEARCH Function

Asked by adam

Hello.
the first, I affirm that search function of phpns very good, but only for English language.

allow me to description my problem:

I have build my homepge not using shownews.php file. it display all articles for guests visiting. on that I allow guests to type something characters to search in all category:

<form ...action="display.php">
<input type=text name="keyword">

display.php
$keyword=$_POST["keyword"];
........
 $sql="SELECT * FROM ".$databaseinfo['prefix']."articles
  WHERE article_title LIKE '%".$keyword."%'
  OR article_text LIKE '%".$keyword."%'
  OR article_exptext LIKE '%".$keyword."%'
  ORDER BY id DESC";
  @$childResult = mysql_query($sql);
.........

will not problem if search the keyword on title of article or all in use is english language.
while all my articles is storing with mother language (not english).

please help me.

thansk

Question information

Language:
English Edit question
Status:
Solved
For:
phpns Edit question
Assignee:
No assignee Edit question
Solved by:
alecwh
Solved:
Last query:
Last reply:
Revision history for this message
alecwh (alecwh) said :
#1

Hello,

I'm sorry adam, I don't quite understand. You're saying that the SQL
query works for ENGLISH, but not for other languages?

Can you be more clear on what you're asking?

Revision history for this message
adam (myadam) said :
#2

ok.

I will take a example to you:

when view my database to see article i see that:
-----
&lt;p&gt;
&lt;img class=&quot;left&quot; src=&quot;upload/images/09_copy_400.jpg&quot; alt=&quot;09_copy_400&quot; title=&quot;09_copy_400&quot; width=&quot;183&quot; height=&quot;128&quot; align=&quot;left&quot;
l&amp;agrave; cuộc bầu cử tốn k&amp;eacute;m nhất trong lịch sử nước Mỹ. Dưới đ&amp;acirc;y l&amp;agrave;
------

When i searching keyword="09_copy_400.jpg" or keyword="class=" in submit form then result return is found but it's tag of HTML.

when keyword="something chars in my language" that I storing in database
then return result is not found. I thinks my articles have encode in database.

sorry English isn't my morther language
thanks for your answer!

Revision history for this message
Best alecwh (alecwh) said :
#3

That's odd, but I assume it's because of the reason you said; the
database may encode your text, making it hard to search.

I don't know very much about foreign languages and their interactions
with mySQL, so I probably can't help you out much. I would try posting
at the mySQL community forums for additional help. This is more of a
database/SQL question more than a phpns question.

Good luck!

Revision history for this message
adam (myadam) said :
#4

Thanks alecwh, that solved my question.