title: How to display a row from a database that selected by the user
body: <p>The program will ask the user to insert an ID in my code. If the ID is found in the database, it will take them to <code>Administrator_Settings()</code>, where they would be given the option to edit, remove, and view the profile connected to that ID. However, In the image provided, I would like to have a table displaying the First and the last name of the profile that the user selected. This is done to verify that the designated account is correct.</p>
  <p>I plan to display information that only belongs to the ID that the user selected in different windows, so any tips on only showing information from the desired profile will be great!</p>
  <p><a href="https://i.stack.imgur.com/WK0Jr.png" rel="nofollow noreferrer">Picture Reference</a></p>
  <p>Here is what I tried so far:</p>
  <pre><code>def search_id():
          import sqlite3
          import tkinter
          # grabbing the inputting id
          lookup_record = United.get()
          conn = sqlite3.connect('MEMBERinformation.db')
          cur = conn.cursor()
          # grabs all the ids from the table
          cur.execute('SELECT MemberID FROM ChurchMemberInformation')
          for row in cur:
              # slicing the retrieved row so it is just the id (no symbols in it)
              row = str(row)[2:9]
              # checking to see if the current row retrieved is equal to the inputted id
              if (str(lookup_record) == row):
                  self.Administrator_Settings()
                  # go to next page by calling the function associated with it (note how I did it below.
                  return
          # if the record does not exist it will end up here
          answer = tkinter.messagebox.askyesno('Not Found',
                                               &quot;This Member is not found. Click 'yes' if you would like to proceed&quot;
                                               &quot; to the directory  and find someone there manually, or click 'no' if &quot;
                                               &quot; you wish to retry again.&quot;)
          if answer:
              self.Directory()
              return
          # if answer is no, it will return to the page
          else:
              return
      
  def connect():
          conn = sqlite3.connect(&quot;MEMBERinformation.db&quot;)
          cur = conn.cursor()
          cur.execute(
              &quot;CREATE TABLE IF NOT EXISTS ChurchMemberInformation(MemberID TEXT PRIMARY KEY, &quot;
              &quot;FirstName TEXT, LastName TEXT, Address TEXT, PhoneNumber)&quot;)
          conn.commit()
          conn.close()
  
      # Frame
      Table1 = Frame(self.ws)
      Table1.pack(anchor=CENTER, side=BOTTOM)
      Table1.place(relx=0.375, rely=0.45)
  
      # Connect the database
      connect()
  
      scrollBAR = Scrollbar(Table1)
      scrollBAR.pack(side=RIGHT, fill=Y)
  
      # Create Treeview widget
      global tree
      tree = ttk.Treeview(Table1, columns=(&quot;column1&quot;, &quot;column2&quot;), show='headings', yscrollcommand=scrollBAR.set)
  
      tree['columns'] = ('FIRST NAME', 'LAST NAME')
      tree.column('FIRST NAME', width=200, anchor=CENTER)
      tree.heading(&quot;#1&quot;, text=&quot;FIRST NAME&quot;)
      tree.column('LAST NAME', width=200, anchor=CENTER)
      tree.heading(&quot;#2&quot;, text=&quot;LAST NAME&quot;)
      tree.pack()
  
      conn = sqlite3.connect(&quot;MEMBERinformation.db&quot;)
      cur = conn.cursor()
      cur.execute(&quot;SELECT FirstName, LastName FROM ChurchMemberInformation&quot;)
      rows = cur.fetchall()
      for row in rows:
          print(United)  # print all records in the database
          tree.insert(&quot;&quot;, tk.END, values=row)
  </code></pre>
  <p>Thank you for your help.</p>