hello i am developing an application in c ++ and mysql and i am having a lot of difficulties in more specified login in the query where the query needs the user and the pass which are in variables.
Can anyone help me?
Thanks.

Recommended Answers

All 5 Replies

thanks for the answer but the question was a login for example:

cout << "user:" << endl;
cin >> user;

cout << "pass:" << endl;
cin >> pass;

my difficulty is here -> "Select * from 'accounts' where user = 'user' And pass = 'pass'";

and I use Code :: Blocks

So my research would be https://www.google.com/search?q=code+blocks+mysql
It appears there are tutorials and examples.

PS. I find your top post unclear and incomplete. Your code is not properly formatted and the C++ system in use was omitted. As you can see, details matter.

OK thanks I will search a bit moreok t

This is me guessing this is not about the MySQL name and password but something else.

There are a lot of bad login systems where they teach to store the username and password in a database. This is a bad idea and has lead to so many security breaches it's not to be taught ever again.

The passwords shall be encrypted and salted then stored. To check if the user entered the right password you take their input, encrypt, salt and then compare that to what's on file. Any system that stores passwords like it was taught over a decade ago should receive a failing grade today. It's that severe a problem.

https://www.google.com/search?q=never+store+passwords+in+a+database covers this over and over.

In your top post I read it as if you needed the name and password to connect to your database. Now I think you meant to ask something else.
As it is the 50th anniversary of Monty Python: "And now for something completely different."

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.