Greetings, I would like you to help me because I want to write the records of a table through a function and what happens is that the id column has added the function that when pressed it takes a text field and the problem is that when you click on this column all the ids in the table go to the text field and I only need the value that you select, this is the function
function Listar($columna){
include("Conexion.php");
$consulta="SELECT $columna FROM usuario";
$resultado=$conexion->query($consulta);
if(mysqli_num_rows($resultado)>=1){
while($usuarios=$resultado->fetch_array(MYSQLI_BOTH)){
$var=$usuarios[$columna];
echo $var."<br>";
}
}else{
echo "no hay registros para listar";
}
And so I'm printing it
<td><a href="#" class="name"><?php echo Listar('id_usuario'); ?></a></td>
I could solve it by printing the data of each user independently since when listing all in the same
echo
were taken as a single column, this was the way to solve it echo "<tr><td class='name'>".$usuarios['id_usuario']."</td><td>".$usuarios['nombre']."</td><td>".$usuarios['apellido']."</td><td>".$usuarios['telefono']."</td><td>".$usuarios['direccion']."</td><td>".$usuarios['correo']."</td><td>".$usuarios['password']."</td></tr>";