python - Cannot validate query results -


    query = "select serialno registeredpcs ipaddress = "     usercheck = query + "'%s'" %fromip     #print("query"+"-"+usercheck)     print(usercheck)     rs = cursor.execute(usercheck)     print(rs)     row = rs     #print(row)     #rs = cursor.rowcount()     if int(row) == 1:         query = "select report1 registeredpcs serialno = "         firstreport = query + "'%s'" %rs         result = cursor.execute(firstreport)         print(result)     elif int(row) == 0:         query_new = "select * registeredpcs"         cursor.execute(query_new)         newrow = cursor.rowcount()+1         print(new row) 

what trying here fetch serialno values db when matches ipaddress. query if working fine. should query result set rs 0. trying use value , else in if else construct. trying check unique values in db based on ipaddress value. getting error

error: uncaptured python exception, closing channel smtpd.smtpchannel connected  192.168.1.2:3630 @ 0x2e47c10 (**class 'typeerror':'int' object not  callable** [c:\python34\lib\asyncore.py|read|83]  [c:\python34\lib\asyncore.py|handle_read_event|442]  [c:\python34\lib\asynchat.py|handle_read|171]  [c:\python34\lib\smtpd.py|found_terminator|342] [c:/users/dev- p/pycharmprojects/cr server local/lrs|process_message|43]) 

i know making basic mistake. think it's part in bold thats causing error. can't put finger on it. tried using rowcount() method didn't help.

rowcount attribute, not method; shouldn't call it.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -