I have to query a DB where i stored credentials for login (for homework). This is my php code but it's not working.
<?php
$user = "cardatabase";
$password = "";
$host = "";
$database = "my_cardatabase";
$connession = mysql_connect($host, $user, $password);
mysql_select_db($database, $connession);
$id = $_REQUEST['id'];
$password = $_REQUEST['password'];
$query = "select Password
from Client
where IDClient = '".$id."'";
$result = mysql_query($query, $connession);
echo $result;
if ($result == $password) {
echo ok;
} else {
echo error;}
mysql_close();
?>
I tried to print the value coming from my html page and it's correct, so there should be a problem with this code but i can't figure it out.
IDClientis of numeric type so you have extra quote around the$id.