Skip to content

Instantly share code, notes, and snippets.

@bastienapp
Created June 11, 2024 11:41
Show Gist options
  • Save bastienapp/12160aed0b65e2e60fcc72cfab4f2bb6 to your computer and use it in GitHub Desktop.
Save bastienapp/12160aed0b65e2e60fcc72cfab4f2bb6 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Démo live coding</h1>
<?php
$servername = 'localhost';
$username = 'root';
$password = 'tacostacos';
//On établit la connexion
$conn = new mysqli($servername, $username, $password, "demo");
//On vérifie la connexion
if($conn->connect_error){
die('Erreur : ' .$conn->connect_error);
}
// j'ai appelé ma base de données et j'ai récupéré les informations de l'utilisateur connecté
$connected_user_id = $_GET["identifiant"];
$result = $conn->query("SELECT * FROM `user` WHERE `user_id` = " . $connected_user_id);
$user_infos = $result->fetch_array();
?>
<main>
<section>
<label>
Email:
<input type="email" value="<?php echo $user_infos["email"]; ?>" />
</label>
<br /><br />
<label>
Prénom:
<input type="text" value="<?php echo $user_infos["first_name"]; ?>" />
</label>
<br /><br />
<label>
Nom:
<input type="text" value="<?php echo $user_infos["last_name"]; ?>" />
</label>
<br />
</section>
</main>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment