I'm using 000webhost for my php server and phpmyadmin for my database. I'm trying to make it so when you enter a username it outputs the password. Can anyone give me suggustions? that would be great!
My html:
<!DOCTYPE html>
<html>
<body>
<form action="Login.php" method="GET">
<input type="text" name="query" />
<input type="submit" value="Search" />
</form>
</body>
</html>
My php:
<?php
$host='localhost';
$user='id1783920_123456';
$pass='';
$db='id1783920_mydb';
/* $pass is the password and I know that's not the problem, I just don't want to share it */
$con=mysqli_connect($host,$user,$pass,$db);
if($con) {
echo 'connected successfully to id1783920_mydb database';
}
$term = $_GET['query'];
$sql = "SELECT password FROM Signup WHERE CONCAT( username) LIKE '%$term%'";
$result = $con->query($sql);
if ($result->num_rows > 0) {
$row = $result->fetch_assoc()
echo "password: " . $row["password"];
} else {
echo "0 results";
}
$conn->close();
?>