Jump to content

Problem with unicode text searching


Gruzin

Recommended Posts

Hi guys,
I have a problem with search an unicode text from db.
I'am using PHP 5.1.2;
MYSQL 5.0.18;
PHPMyAdmin 2.8.0.3;

My Storage Engine is - InnoDB;
Collation: utf8_unicode_ci;

Can enyone tell me the reason please? It does find the english word, but not (Georgian) unicode....
Here is a code, hope someone will save me, thanks for reading:

[code]<?php

$var = $_GET['search'] ; // get the query for the search engine
$trimmed = trim($var); //trim whitespace from the stored variable
if(empty($trimmed)){
  echo "error"; // if the form is emty notify user
  echo "<br>";
  echo "<a href='javascript:history.back()'> error </a>";
  exit();
  }
 
$count = strlen($trimmed);
if($count <=  2){
  echo "error"; // count chars inputed in form if less then 2 then exit
  echo "<br>";
  echo "<a href='javascript:history.back()'> error </a>";
  exit();
  }

require("config.php");
$query =
"SELECT * FROM Mater WHERE MatName LIKE '$trimmed'
UNION
SELECT * FROM Mater WHERE MatNameE LIKE '$trimmed'"; // run query for all tables to get the result

$result = mysql_query($query) or die(mysql_error());
$num = mysql_num_rows($result); //number of matching rows

echo "<span class='header'>$num found</span>"; // show the number of matching results before loop
echo "<br>";
echo "<a href='javascript:history.back()'> Go Back </a>";

if($num > 0){    //at least one match
  while($row = mysql_fetch_assoc($result)){ //to loop through all of the matches
 
$url = $row['url'];
$title = $row['title'];

echo '<p>';
echo "<a href='".$url."'>". $title;
echo '</a>';
}
  }
  else{
  echo '<br>';
  echo "<a href='home.php'> Try Again </a>";
  }
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/27613-problem-with-unicode-text-searching/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.