Hi guys,
I'm trying to modify the plaincart for my needs but I have problem with the cyrillic characters. When I call the data from the database, all I get is ???????.
My database is ok, the collation is utf8_unicode_ci and I can see my characters correctly in phpMyAdmin.
for example here is the index.php:
<?php
require_once 'library/config.php';
require_once 'library/category-functions.php';
require_once 'library/product-functions.php';
require_once 'library/cart-functions.php';
$_SESSION['shop_return_url'] = $_SERVER['REQUEST_URI'];
$catId = (isset($_GET['c']) && $_GET['c'] != '1') ? $_GET['c'] : 0;
$pdId = (isset($_GET['p']) && $_GET['p'] != '') ? $_GET['p'] : 0;
require_once 'include/header.php';
?>
<table width="780" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3">
<?php require_once 'include/top.php'; ?>
</td>
</tr>
<tr valign="top">
<td width="150" height="400" id="leftnav">
<?php
require_once 'include/leftNav.php';
?>
</td>
<td>
<?php
if ($pdId) {
require_once 'include/productDetail.php';
} else if ($catId) {
require_once 'include/productList.php';
} else {
require_once 'include/categoryList.php';
}
?>
</td>
<td width="130" align="center"><?php require_once 'include/miniCart.php'; ?></td>
</tr>
</table>
<?php
require_once 'include/footer.php';
?>
and the database file:
<?php
require_once 'config.php';
$dbConn = mysql_connect ($dbHost, $dbUser, $dbPass) or die ('MySQL connect failed. ' . mysql_error());
mysql_select_db($dbName) or die('Cannot select database. ' . mysql_error());
function dbQuery($sql)
{
$result = mysql_query($sql) or die(mysql_error());
return $result;
}
function dbAffectedRows()
{
global $dbConn;
return mysql_affected_rows($dbConn);
}
function dbFetchArray($result, $resultType = MYSQL_NUM) {
return mysql_fetch_array($result, $resultType);
}
function dbFetchAssoc($result)
{
return mysql_fetch_assoc($result);
}
function dbFetchRow($result)
{
return mysql_fetch_row($result);
}
function dbFreeResult($result)
{
return mysql_free_result($result);
}
function dbNumRows($result)
{
return mysql_num_rows($result);
}
function dbSelect($dbName)
{
return mysql_select_db($dbName);
}
function dbInsertId()
{
return mysql_insert_id();
}
?>
I've tried adding mysql_query('SET NAMES utf8'); after mysql_connect() but it didn't worked.
Any suggestions?
Thanks