'SQL request with list is not iterated in python
i have a list that a created after executing the sql request:
for w in ws.iter_rows (min_row = 1, min_col = 1, max_col = 1):
for cell in w:
termowner = cell.value
zinput.append(str(termowner))
The list consists of values that i need to use in next sql query, but some reason the query is not iterate, so i get sql query result consists of a single value:
for j in range(len(zinput)):
print(j,zinput[j])
print(counter)
cursor.execute ("select phone_number from clients where clients_id = ?",zinput[j])
Pls, does anyone know how to solve the problem.
The whole code:
zinput=[]
for w in ws.iter_rows (min_row = 1, min_col = 1, max_col = 1):
for cell in w:
termowner = cell.value
zinput.append(str(termowner))
print(zinput) counter = 0
for j in range(len(zinput)): print(j,zinput[j]) print(counter)
cursor.execute ("select phone_number from clients where clients_id = ?",zinput[j])
results = cursor.fetchall()
counter +=1
print(results)
print('iter',counter, 'done')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
