Answer the question
In order to leave comments, you need to log in
Why are krakozyabry written when executing a function?
Using the plugin, I insert the function into the wordpress news. It works on my site, but when I paste it on another site, all the text is written in such letters: ЂРјРёС‚СЊ R·Р°СЏРІРєСѓВ”. Р'сего 15 РјРёРЅСѓС‚ Рё РґРµР.
The function takes data from the database and displays it in the form of a table.
Inserted the table into the database. copied the file with the function too. Other functions from my site work correctly on this one. Everything is the same as on my website. I can't figure out what's wrong, because I don't understand what is written.
Function code:
function get_fix_ch ($company = '', $ch_id = '') {
global $link;
if ($ch_id == '')
$where_ch = '`display` = 1 AND `work` = 1';
else {
if (strpos($ch_id, ','))
$where_ch = "`display` = 1 AND `work` = 1 AND `id` IN ($ch_id)";
else
$where_ch = "`id` IN ($ch_id)";
}
if ($company != '')
$where_comp = "AND `company` LIKE '%$company%'";
$query = "SELECT * FROM `cpl_fix_ch` WHERE $where_ch $where_comp ORDER BY `rating`";
$result = mysqli_query($link, $query) or die(mysqli_error($link));
$result = mysqli_fetch_all($result, MYSQLI_ASSOC);
foreach ($result as $elem) {
$table .= '<tr>
<td>'.$elem["name"].'<br /><img class="img-org" src="/img/ch/165/'.$elem["img"].'.png" alt="'.$elem["company"].'" /><br /><i>Цена программы: '.$elem["price"].'</i></td>
<td><ul class="credit_dopinfo-list"><li>Проценты: '.$elem["percent"].'</li>
<li>Сумма: '.$elem["sum"].'</li>
<li>Срок: '.$elem["time"].'</li></ul>
</td>
<td>'.$elem["included"].'</td>
<td><a href="'.$elem["link_offer"].'" target="_blank" rel="nofollow"><a style="font-size: 16px; padding: 0.6em 0.5em;" target="_blank" rel="nofollow" href="'.$result[$key]["link_offer"].'" class="button1 blue-red">ОСТАВИТЬ ЗАЯВКУ</a></td>
</tr>'.PHP_EOL;
$list .= '<ul class="list-credit">
<img class="listCredit-imgOrg" src="/img/ch/'.$elem["img"].'.png" alt="'.$elem["name"].'" />
<li>Название программы: '.$elem["name"].'</li>
<li>Цена программы: '.$elem["price"].'</li>
<li>Займ, доступный в программе:
<ul><li>Проценты: '.$elem["percent"].'</li>
<li>Сумма: '.$elem["sum"].'</li>
<li>Срок: '.$elem["time"].'</li></ul>
</li>
<li>Программа включает в себя:'.$elem["included"].'</li>
<li><a style="font-size: 24px;" target="_blank" rel="nofollow" href="'.$elem["link_offer"].'" class="button1 blue-red">ОСТАВИТЬ ЗАЯВКУ</a></li>
<hr />
</ul>'. PHP_EOL;
}
return '
<p class="table-note">В таблице (списке) представлена регулярно обновляемая, актуальная на '.rus_date("j F Y").' года информация.</p>
<table class="table-credit">
<thead>
<tr>
<th>Программа</th>
<th>Займ</th>
<th>Включает</th>
<th>Онлайн заявка</th>
</tr>
</thead>
<tbody>'.PHP_EOL .$table.'</tbody>
</table>'.PHP_EOL .
$list;
}
Answer the question
In order to leave comments, you need to log in
throw off the function code? maybe another site has a different encoding, check it
The problem is clearly with the encoding ... As ljutaev noted, another site may have a different encoding win 1254 or win1251, etc.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question