Click here to Skip to main content
15,567,221 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello everyone! I want to do something, but I don't know exactly how, why I tried it, but nothing. I want to see my registered data, but only 1 column.

This is my code PHP:

<!doctype html>
<html lang="en">
<head>
	<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">
	<title>Mis datos</title>
</head>
<body>
<table>
 <?php 
  include ("../conex.php");
 
 $sql="select * from usuario";
$resultado=mysqli_query($conn,$sql);

while($mostrar=mysqli_fetch_array($resultado))

{
?>

<tr>
	<td><?php echo $mostrar['name'] ?></td>
	<td><?php echo $mostrar['last'] ?></td>
	<td><?php echo $mostrar['nameDad'] ?></td>
	<td><?php echo $mostrar['nameMom'] ?></td>
	<td><?php echo $mostrar['tipoIdentificacion'] ?></td>
	<td><?php echo $mostrar['identificacion'] ?></td>
	<td><?php echo $mostrar['telefono'] ?></td>
	<td><?php echo $mostrar['email'] ?></td>
	<td><?php echo $mostrar['address'] ?></td>
	<td><?php echo $mostrar['born'] ?></td>
	<td><?php echo $mostrar['rango'] ?></td>
	<td><?php echo $mostrar['estadoC'] ?></td>
	<td><?php echo $mostrar['sex'] ?></td>
	<td><?php echo $mostrar['pass'] ?></td>
</tr>

<?php
}
?>

</table>
 
	
</body>
</html>


What I have tried:

I've tried some things on the internet but I can't get what I want
Posted
Updated 18-Nov-21 5:02am
Comments
Richard Deeming 18-Nov-21 9:58am    
Based on your column names, it looks like you're storing your users' passwords in plain text. Don't do that!
Secure Password Authentication Explained Simply[^]
Salted Password Hashing - Doing it Right[^]

PHP even provides built-in functions to help you do the right thing:
PHP: password_hash[^]
PHP: password_verify[^]

1 solution

If you want all the data in a single column then each item needs to be in a separate row:
HTML
<tr><td><?php echo $mostrar['name'] ?></td></tr>
<tr><td><?php echo $mostrar['last'] ?></td></tr>
<tr><td><?php echo $mostrar['nameDad'] ?></td></tr>
<tr><td><?php echo $mostrar['nameMom'] ?></td></tr>
// etc.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900