CREATE TABLE my_table (
id INT AUTO_INCREMENT,
first_name VARCHAR(100),
last_name VARCHAR(100),
PRIMARY KEY (id)
);
INSERT INTO my_table(first_name, last_name) VALUES
('Chad', 'Hawk'),
('Ned', 'Flanders'),
('Dave', 'Jonson'),
('Newt', 'G'),
('Bill', 'Ng'),
('Norton', 'Who'),
('Alan', 'Joyce'),
('John', 'Smith'),
('Jeff', 'Johnson');
<?php
function mask($value)
{
return preg_replace('/^.{0,3}\K.*/', '***', $value);
}
$result = mysqli_query($conn, "SELECT * FROM sign_in3 ORDER BY date LIMIT 5");
foreach ($result as $row) {
printf(
"<tr>
<td>%s</td>
</tr>
<tr>
<td>%s</td>
</tr>\n",
mask($row['first_name']),
mask($row['last_name']))
);
}