title: is there a way to fix this error i am getting?
body: <p>This is the frontend of my program. This a function to delete a set of records from a table. It gives me this error:project1Database.deleteRec(sd[0])
  NameError: name 'sd' is not defined. I know it probably a little mistake by I am still new to coding so anything can help.</p>
  <pre class="lang-py prettyprint-override"><code>def EmployeeRec(event):
      global sd
      searchEmp = employeelist.curselection()[0]
      sd = employeelist.get(searchEmp)
   
      self.txtEmpID.delete(0,END)
      self.txtEmpID.insert(0,sd[1])
  
      self.txtFirstname.delete(0,END)
      self.txtFirstname.insert(END,sd[2])
  
      self.txtMiddlename.delete(0,END)
      self.txtMiddlename.insert(END,sd[3])
  
      self.txtLastname.delete(0,END)
      self.txtLastname.insert(END,sd[4])
  
      self.txtDob.delete(0,END)
      self.txtDob.insert(END,sd[5])
  
      self.txtNationality.delete(0,END)
      self.txtNationality.insert(END,sd[6])
  
      self.txtNI.delete(0,END)
      self.txtNI.insert(END,sd[7])
  
      self.txtAddres.delete(0,END)
      self.txtAddres.insert(END,sd[8])
  
      self.txtPostcode.delete(0,END)
      self.txtPostcode.insert(END,sd[9])
  
      self.txtphonenumber.delete(0,END)
      self.txtphonenumber.insert(END,sd[10])
  
      self.txtEmail.delete(0,END)
      self.txtEmail.insert(END,sd[11])
  
      self.txtPassportnumber.delete(0,END)
      self.txtPassportnumber.insert(END,sd[12])
  
      self.txtPassportexpirydate.delete(0,END)
      self.txtPassportexpirydate.insert(END,sd[13])
  
      self.txtgender.delete(0,END)
      self.txtgender.insert(END,sd[14])
   
  
  def deleteData():
      if(len(EmpID.get())!=0):
          project1Database.deleteRec(sd[0])
          clearData()
          displayData()
  </code></pre>
  <p>This is the backend. This is the table for my program.</p>
  <pre class="lang-py prettyprint-override"><code>import sqlite3
  
  #backend
  
  def employeeData():
      conn = sqlite3.connect('projectv4.db')
      c= conn.cursor()
  
      c.execute(&quot;&quot;&quot;CREATE TABLE IF NOT EXISTS employee(EmployeeID INTEGER PRIMARY KEY,EmpID text,
      Firstname text,Middlename text, Lastname text,
      Dob text, Nationality text, NI text, Addres text, Postcode text,  phonenumber text,
      Email text, Passportnumber text, Passportexpirydate text,
     gender text)&quot;&quot;&quot;)
      conn.commit()
      conn.close()
  </code></pre>
  <p>This is the function I am trying to call from my frontend:</p>
  <pre class="lang-py prettyprint-override"><code>def deleteRec(EmployeeID):
      conn = sqlite3.connect('projectv4.db')
      c= conn.cursor()
      c.execute(&quot;DELETE FROM employee WHERE EmployeeID = ?&quot;, (EmployeeID,))
      conn.commit()
      conn.close()
  </code></pre>