Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
create table utf8mb3 (str varchar(255)) character set utf8;
insert into utf8mb3 values ('foo');
<?php
$pdo->query("set names utf8mb4");
try {
$pdo->query("select * from utf8mb3 where str='😂'");
} catch (Throwable $e) {
echo $e->getMessage(),"\n";
}
$pdo->query("ALTER TABLE utf8mb3 CONVERT TO CHARACTER SET utf8mb4");
$pdo->query("select * from utf8mb3 where str='😂'");
echo $pdo->query("show create table utf8mb3")->fetch()[1];