I set my database settings to be
MySQL charset: UTF-8 Unicode (utf8)
MySQL connection collation: utf8_general_ci
and here is my module that inserts records in the database
<?php
class userscoresmodule extends CI_Model{
function __construct(){
parent::__construct();
$this->load->database();//Φορτώνει την βάση δεδομένων
}
function AddUserScore($userID,$userName,$score,$userLastname){
$data=array('userID' => $userID,
'userName' => $userName,
'userLastname' => $userLastname,
'score' => $score);
$this->db->insert('highscores', $data);
}
public function getAllScores(){ //Επιστρέφει τα προϊόντα
$this->db->select('*');
$this->db->from('highscores');
$this->db->limit(10);
$this->db->order_by("score", "desc");
$query = $this->db->get();
//$query = $this->db->get('highscores');
return $query->result_array(); // Επιστρέφει το αποτέλεσμα με την μορφή array
}
}
?>
The problem is that when it adds a record with greek characters in the database is like ????????
. I read in some posts that I have to set my database on UTF-8 , have I to do something else on the module too?