Click here to Skip to main content
15,994,910 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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";

but it show an error... the error is that it simply show the message

PHP
username or password already exists


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..
Posted
Comments
Mohibur Rashid 24-Apr-13 22:50pm    
Where do you get $username and $password? it seems to me they are never initialized, just guess

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900