Ario Rakip Ario Rakip - 1 year ago 95
MySQL Question

Unable to retrieve data from MYSQL Database in PHP

I am trying to retrieve the password of a user, when given the email.

$query = "SELECT password FROM `users` WHERE email='$username'";
$result = mysqli_query($query);
echo $row;

But it does not seem to work. Can anyone figure what's the problem?

Thanks in advance.

Answer Source

You Need To Connect To Your Database

$connection = new mysqli('Host Name', 'Username', 'password', 'Database Name', 'port(Optional)');

Second mysqli_query($query); Should Be mysqli_query($connection, $query);

Third $row Is An Array To Echo A Database Value Use $row['column']

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download