0
need a light to return only a specific value according to the login done.
Example: if the database username is "Amora" returns the value of the column Name whose username is Amora.
I believe it is related to SELECT but I do not know how to do if you can give me some hint.
<?php
require_once 'config.php';
try {
$sql = 'SELECT username,
password,
Nome
FROM login
ORDER BY Nome';
$q = $con->query($sql);
$q->setFetchMode(PDO::FETCH_ASSOC);
} catch (PDOException $e) {
die("Could not connect to the database $database :" . $e->getMessage());
}
?>
<!DOCTYPE html>
<html>
<head>
<title>WMS - Lear Betim</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<div id="container">
<table class="table table-bordered table-condensed">
<tbody>
<?php while ($row = $q->fetch()): ?>
<tr>
<td> <?php echo htmlspecialchars('Olá' . ", " . $row['Nome']); ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</body>
</div>
</html>
If to return the record of the login table where Name = Amora select columns from login Where Name = 'Amora' ....
– Marcos Xavier
Thank you for your comment helped me to solve the problem in question. I used $sql = "SELECT username, password, Name FROM login WHERE username = 'amora'";
– Dênis Suenaga