user already exists error in php PDO

hy to every one… iam new in php and working with PDO interaction to mysql. iam going to filter user input data using…
[php]if(!filter_input(INPUT_POST,’$username’)||!filter_input(INPUT_POST,’$password’))
{
echo “username or password already exists…”;

    }

    else
    {

$sql = “INSERT INTO users (Username,Password) VALUES (:username,:password)”;
$q=$dbh->prepare($sql);
$q->execute(array(’:username’=>$username,’:password’=>$password));
$count=$q->rowCount();
echo “inserted $count rows.\n”;[/php]
but it show an error… the error is that it simply show the message

[php]username or password already exists[/php]

if the username or password is not exists it show the same message? what can i do? if some one have any idea then put it to my code… if the filter_input() is not used her then what can i use insted of… plz solve it… thank’s in Advance…

php[/php]

filter_input() returns “NULL if the variable_name variable is not set”

You should be specifying strings not variables (remove the $)

php[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service