python python mysql 접속 테스트
페이지 정보

본문
import pymysql
dbcon = pymysql.connect(host='localhost', user='root', password='lovesuk', db='control_box')
#curs = dbcon.cursor() # 배열형태
curs = dbcon.cursor(pymysql.cursors.DictCursor) # 연관배열형태
sql = " select * from adam_8025 order by adam_no asc "
curs.execute(sql)
#row = curs.fetchone()
read_data = curs.fetchall()
for read_row in read_data:
print(read_row)
sql = "update adam_8025 set "
sql = sql + " no_1 = '" + str(1) + "' "
sql = sql + " where adam_no = '" + str(1) + "' "
curs.execute(sql)
dbcon.commit()
dbcon.close()
- 이전글다음지도 api : 여러개의 주소를 읽어와서 검색하고 마커 찍기 23.01.10
- 다음글그누보드 sms 보내기 22.11.21
댓글목록
등록된 댓글이 없습니다.