I tried executing the below code. Here, it prints the correct value for usr as admin but not for did. It should be fetching the id of the corresponding username admin and giving value as DOC1, from the doctors table. Instead, it prints as None. I am not able to figure out why None comes and not DOC1.
def post(self):
usr = self.current_user
did = self.db.execute("SELECT id FROM doctors WHERE username ='%s'" % usr;")
print usr
print did
looks like you have extraneous characters (;”) after the last ‘usr’ variable at the end. remove those.