I'm setting up the RFID reader for the attendance system. But when I place my tag to the reader, it was interrupted with the Tag id - which I externally stored to a database.
#//////place your tag//////
print("Now place your tag to write")
rdr.wait_for_tag()
(error, data) = rdr.request()
if not error:
print("\nDetected: " + format(data, "02x"))
(error, uid) = rdr.anticoll()
if not error:
print("Card read UID: " +str(uid[0])+str(uid[1])+str(uid[2])+str(uid[3]))
tagid = str(uid[0])+str(uid[1])+str(uid[2])+str(uid[3])
print("Written..!")
print(tagid)
cursor.execute("insert into rfid_check (uid,firstname,age,tag_id) values ('%s','%s','%s','%s')" %(user_id,fname, ag_e, tagid))
connection.commit()
print("Data was successfully Added...!")
tagid = str(uid[0])+str(uid[1])+str(uid[2])+str(uid[3])
IndexError: list index out of range