Get rid of the quotation marks from your query. Also look at my modifications of your query.
bool check_cred()
{
query.prepare("select COUNT(*) from credentials where uname=:id and passwd=:pd");
query.bindValue(":id", username);
query.bindValue(":pd", password);
if(!query.exec() || !query.next()) return false;
return (query.value(0).toInt()>0);
}
bool check_cred()
{
QSqlQuery query;
query.prepare("select COUNT(*) from credentials where uname=:id and passwd=:pd");
query.bindValue(":id", username);
query.bindValue(":pd", password);
if(!query.exec() || !query.next()) return false;
return (query.value(0).toInt()>0);
}
To copy to clipboard, switch view to plain text mode
Better yet don't store plaintext passwords but rather some hashes (like sha1 or md5).
Bookmarks