Hi, how are you,
I come with a doubt because it does not show me the data of my mysql database in a table that believes in my html. You skip the first user, it is worth mentioning that you already check my connection, the name of the fields in detail and the links.
Currently I have this like this:
<?php
session_start();
require'funcs/conexion.php';
if(!isset($_SESSION["id_usuario"])){
header("Location: index.php");
}
?>
<?php
$sql = "SELECT id, nombre, costo, horario, acercade, edad, sexo, servicios, usuario_municipio FROM usuarios";
$stmt = $mysqli->prepare($sql);
if ($stmt) {
$stmt->execute();
$stmt->store_result();
$row = mi_fetchassoc($stmt);
}
// $stmt->free_result();
$mysqli->close();
function mi_fetchassoc($stmt)
{
if ($stmt->num_rows>0)
{
$rs = array();
$md = $stmt->result_metadata();
$params = array();
while($field = $md->fetch_field()) {
$params[] = &$rs[$field->name];
}
call_user_func_array(array($stmt, 'bind_result'), $params);
if($stmt->fetch())
return $rs;
}
return null;
}
?>
<html>
<head>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-theme.css" rel="stylesheet">
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
</head>
<body>
<div class="container">
<div class="row table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>Nombre</th>
<th>Costo</th>
<th>Horario</th>
<th>Edad</th>
<th>Sexo</th>
<th>Servicios</th>
</tr>
</thead>
<tbody>
<?php while($row = mi_fetchassoc($stmt))
{ ?>
<tr>
<td><?php echo $row['nombre']; ?></td>
<td><?php echo $row['costo']; ?></td>
<td><?php echo $row['horario']; ?></td>
<td><?php echo $row['edad']; ?></td>
<td><?php echo $row['sexo']; ?></td>
<td><?php echo $row['servicios']; ?></td>
<td></td>
<td></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</body>
</html>
But it does not show me the first registered user only the others, why would this problem be? sorry for the clutter in the code I still do not know how to order the code.
I hope someone can guide me
Greetings.