2012-08-22 72 views
0

我正在编写一个应连接到我的网站上的php文件的程序。在C#中他们输入一个值(密码)。然后密码将发送到网页(example.com/example.php?param=<password>如果值在mysql中,则返回true

我知道如何让程序发送密码,但我不知道如何比较输入的值与我的mysql数据库表中的值。如果该值在数据库中,我希望它返回true。

+1

如果您比较来自用户在数据库原始密码的原始密码,你正在做检查的价值它错了。 – 2012-08-22 20:00:41

+1

到目前为止你有什么?请在问题中发布。 – Matt

+0

是SQL还是PHP给你带来麻烦? –

回答

2

SQL

SELECT `password` 
    FROM `tableName` 
    WHERE `password` = :password 

:密码应该是你在数据库

+0

不应该反引号,而不是单引号? – octern

+0

是的我不好感谢指出 –

0
select 1 from your_table where password = 'thepass' 
0
$result = mysql_query("SELECT * FROM table1 where password = '$password'", $link); 
$num_rows = mysql_num_rows($result); 
if($num_rows >0) 
    return true; 
return false; 
相关问题