2017-03-20 1 views
0

내가 원하는 것은 update 문을 수행하고 두 개의 CGI python 변수 인 inputMin 및 inputMax를 가져 오는 것입니다.CGI Python을 사용하여 SQL 문에 변수 가져 오기

curInsert.execute("Update User set SetMinF = %d, SetMaxF = %d" .format(inputMin, inputMax))  

변수에 가져올 수있는 올바른 구문은 무엇입니까 : 여기

내가 가진 무엇인가? %d? %s? ??

답변

0

을 시도, 그것은 바보 같은 일이었다. 수레를 사용하고 % f이 (가) 필요하므로 다음과 같이 표시됩니다.

curInsert.execute("Update User set SetMinF = %f, SetMaxF = %f" % (inputMin, inputMax)) 
0

내가 그것을 알아 냈 curInsert.execute("Update User set SetMinF = %s, SetMaxF = %s" % (inputMin, inputMax))

관련 문제