0
I have a page that connects in the database and brings information correctly, however I would like to put information in a form using the select field, but I’m having some difficulties if someone can help me follow my code.
<?php
require_once 'init.php';
// abre a conexão
$PDO = db_connect();
// SQL para selecionar os registros
$sql = "SELECT cliente FROM clientes";
// seleciona os registros
$stmt = $PDO->prepare($sql);
$stmt->execute();
?>
<html>
<head>
<meta charset="utf-8">
<title>Lab</title>
</head>
<body>
<h1>Lab</h1>
<?php while ($user = $stmt->fetch(PDO::FETCH_ASSOC)): ?>
<?php echo $user['cliente'] ?>
<?php endwhile; ?>
</body>
</html>
Thank you worked right however missed in opening the first line o {
– Henc
Really, I’ll edit here.
– user28527