I've searched for about the last 3 hours for a solution, but it doesn't work.
MySQL doesn't support utf8mb4 (this is one solution I can't test).
Thank you!
I've searched for about the last 3 hours for a solution, but it doesn't work.
MySQL doesn't support utf8mb4 (this is one solution I can't test).
Thank you!
Here is an example DB connection using PHP and MySQL 5.5.3:
public function_construct($host, $db, $user, $pass){
try {
$this->conn = new PDO("mysql:host = {$host};
dbname = {$db};
charset = utf8mb4",
$user,
$pass);
} else { exit(); }
}
As of release 5.5.3 utf8mb4 is fully backwards compatible with utf8. If you are working with an existing database look for the MySQL configuration file and change instances of 'utf8' to 'utf8mb4' accordingly.
Use Mysql blob field, save images directly there, although I personally don't like saving images in DB, save links to files instead.
$img = mysql_escape_string(file_get_contents('imagefile.gif'));
Then you would insert this $img into db.