Jak w tym kodzie zrobić aby np *** zmieniały się na [b] lub [/b] w zależności czy były wcześniej, oraz żeby dane z bazy ładowały się jako html.
<?php
function db_connect($host,$user,$pass,$db) {
$mysqli = new mysqli($host, $user, $pass, $db);
$mysqli->set_charset("utf8");
if($mysqli->connect_error)
die('Connect Error (' . mysqli_connect_errno() . ') '. mysqli_connect_error());
return $mysqli;
}
$mysqli = db_connect('localhost','login','hasło','database');
$sql = "SELECT * FROM tabela";
$result = $mysqli->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
echo '<div class="col-md-12" style="margin-top: 20px;">
'. nl2br($row['strona']) .'
</div>';
}
} else {
echo "0 results";
}
$mysqli->close();
?>