+ 1
The mysql execute method only takes 2 parameters. The query string as the first is required and the 2nd as a tuple is optional. Change the execution to; cursor.execute(self.Sql, (email, passwrd)) and give that a try.
14th Apr 2020, 4:49 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Your if else statement will always be false. self.Sql is a string object if self.Sql: is basically asking if the string object exists, which it does with a value that is hard coded above. You then use not to negate the returned true to false.
14th Apr 2020, 5:40 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
You need to use fetchall() to try and get any rows from the table that match the query. If no rows exist then an empty string is returned. You can then do a check to see if the value returned is empty do x else do y.
14th Apr 2020, 5:44 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
fetchall() returns a list of tuples if at least 1 row is found from the query or an empty string if nothing is found. So you can use it like you can any other tuple within a list provided you use accordingly to the types of values returned.
14th Apr 2020, 6:17 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Shashank Mishra I think you mean the EXISTS operator. I don't think it will work here as I believe it is used with 2 tables that have a relationship. I could be wrong though.
16th Apr 2020, 4:33 AM
ChaoticDawg
ChaoticDawg - avatar
0
Sql provide a method called as EXTIES () ..
16th Apr 2020, 4:13 AM
Shashank Mishra
Shashank Mishra - avatar
0
Its work bro on single table also
16th Apr 2020, 4:39 AM
Shashank Mishra
Shashank Mishra - avatar