I have been trying to make working php code which will return "1".
As well the database information is all removed, but is accurate since I get no "3" error.
Example being: www.mysite.com/login.php/?test=itemindatabase
and if "itemindatabase" is found in the database, then it will return "1"
A few notes:
login is the name of the table.
test is the name of the only column (other than id)
<?php
$host = "localhost";
$username = "";
$password = "";
$database = "";
$connect = new PDO("mysql:host=$host; dbname=$database", $username, $password);
$connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
if(empty($_POST["test"]))
{
die("3");
}
else
{
$query = "SELECT * FROM login WHERE test = :test";
$statement = $connect->prepare($query);
$statement->execute(
array(
'test' => $_POST["test"]
)
);
$count = $statement->rowCount();
if($count > 0)
{
die("1"); //success!
}
else
{
die("0"); //fail not found
}
}
?>
I have only been getting "0" every try which means failure.