Hi everyone!
How is everybody?
Help me modify this code to show a user profile.
I need to show all the data but do not know how to put in the code to display data and other insurance I have to change the sql query.
If the logged sample data and an edit button but this only shows the data logged.
On aggregate only is the connection to the database.
This is my PHP code:

<?php 
              include_once ('./global.php'); 
              if($_SESSION['username']){ 
$result = mysql_query('SELECT * FROM users WHERE username = "' . $_SESSION['username'] . '"'); 
$usuario = mysql_fetch_array($result); 
mysql_free_result($result); 
 echo   $username['username']; 
echo    $nombre['nombre']; 
echo '<a href="editar.php">Modificar perfil</a>'; 
              }else{ 
                  $result = mysql_query('SELECT * FROM users WHERE username = "' . $_SESSION['username'] . '"'); 
$usuario = mysql_fetch_array($result); 
mysql_free_result($result); 
 echo   $username['username']; 
              } 
               ?>

If I can help I thank you!
Thanks.:)

Member Avatar for P0lT10n

If you depend on a button call edit, put in the if, this

if($_SESSION['username'] && isset($_POST['edit'])){
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.