![]() |
|
[C] MySQL login - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [C] MySQL login (/showthread.php?tid=5788139) |
MySQL login - ReBeL_1 - Jan 21, 2018 Trying to implement a login system, I'm struggling to get it working. I'm using Qt and MySQL - the MySQL link is functioning fine, just can't get the C++ right. I understand that the system will be susceptible to sql injections - I'm fine with that (for now), as my project involves showing progress. Here's the code: Code void MainWindow::on_pushButton_login_clicked()RE: MySQL login - HFDone - Jan 21, 2018 i think your problem is the single quotes http://doc.qt.io/qt-5/sql-sqlstatements.html RE: MySQL login - ReBeL_1 - Jan 21, 2018 Querying the DB hasn't been the problem, it returns the correct username and password but they check is at fault. RE: MySQL login - ZwClose - Jan 22, 2018 Try strncmp instead, it's both ANSI and Unicode, might be your problem. RE: MySQL login - Irritiable - Feb 23, 2018 (Jan 21, 2018 07:41 AM)ReBeL_1 Wrote: Querying the DB hasn't been the problem, it returns the correct username and password but they check is at fault. Hello, ReBeL_1. I'm unfamiliar with Qt personally, so take what I have to say with a grain of salt, please. QString seems to be a C-style string. You are using C++. You could avoid using the C functions and use a std::string in it's place. Code QString foo;If what Cute Little Girl suggested is true: This will be an easier to read solution to the problem. Sorry that I can't be of more assistance. 😖 |