@
@
@deadended2016-02-17 11:04:00
MySQL
@deadended, 2016-02-17 11:04:00

How can I convert a string without using the deletion pattern spec. characters for querying SQL data in Russian?

Hello everyone, DB on utf8. Script too.
There are two queries like this:

$query="SELECT distinct section, city_id FROM  `$table` WHERE main_id LIKE '%$main_id%' group by section";
$regs=mysqli_query($link, $query) or die ("Error" . mysqli_error($link)); 
while($result = mysqli_fetch_assoc($regs))
{
$id=$result['city_id'];
$section=$result['section']; // вот это получаем в $section ="Эвакуация автомобилей | Заказ спецтехники";
//$section=mb_substr($section, 0, 20); - если обрезать строку до пробелов то след. запрос работает  
$id=clear_city("$id"); //убрали все лишнее включая пробелы после "г. "
}
$query2="SELECT distinct fullname, section, city_id FROM  `$table` WHERE city_id LIKE "%city_id%" AND section LIKE \"%$section%\" group by fullname";

I made it with two requests. so it seems faster to me. the second query gives nothing if you search for the string as is, through LIKE or strictly = . It turns out that the script mixes special. characters and change the encoding.
How to make the same query format as the data in the database without filtering and manipulating the string?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question