<table class="table">
<thead>
<tr>
<th>Titulo/Nombre</th>
<th>Creado</th>
<th>Views</th>
</tr>
</thead>
<tbody>
<?php
$inicio = 0;
$sql = "Select * From post WHERE user_name = '$user_name' and privado = 0 ORDER BY dateposted DESC LIMIT ".$inicio.",10";
if (!$pedir = $mysqli->query($sql)){
echo 'Fallo al consultar la base de datos.<br>';
echo 'Errno: ' . addslashes ($mysqli->errno).'<br>';
echo 'Error: ' . addslashes ($mysqli->error).'<br>';
exit;
}
if ($uri_mode){
$func = 'b10tobstr';
} else {
$func = 'doNoThing';
}
if($pedir->fetch_assoc() != null){
while($fila = $pedir->fetch_assoc()) {
if(strlen($fila['Titulo']) > 30){ $titulosh = mb_substr( $fila['Titulo'], 0, 30 ).'...';}else{$titulosh=$fila['Titulo'];}
$dateposted = $fila['dateposted'];
$timestamp = strtotime($dateposted);
$meses = array("Ene","Feb","Mar","Abr","May","Jun","Jul","Agost","Sept","Oct","Nov","Dic");
$dateposted = date('d', $timestamp)."/".$meses[date('n')-1]. "/".date('Y', $timestamp) ;
?>
<tr>
<td class="col-sm-5"><a data-bs-toggle="tooltip" data-bs-placement="left" title="<?=$fila['Titulo']?>" href=".?v=<?=$func($fila['postID'])?>"><?=$titulosh?></a></td>
<td class="col-auto"><?=$dateposted?></td>
<td class="col-auto"><?=$fila['views']?></td>
</tr>
<?php } }else{ ?>
<tr scope="row">
<td colspan="4">
<div class="mb-2 p-2 rounded alert alert-warning" role="alert"><i class="fa fa-exclamation-triangle" aria-hidden="true"></i> Aún no tienes ningun post</div>
</td>
</tr>
<?php } ?>
</tbody>
</table>