Escaping confusion with Python 3 + MySQL

Νίκος Βέργος me.on.nzt at gmail.com
Sun Mar 26 11:19:49 EDT 2017


domain = '.'.join( host.split('.')[-2:] )

domain = '%' + domain + '%' 
domain = '%%%s%%' % domain 
domain = '%{}%'.format(domain)

cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%s" ''', 
																																			(pID, domain, ref, location, useros, browser, lastvisit, domain) )

i just tried both of these 3 ways and the database wrapper failed on all of them respectively.

they gave no error_log output though just the usual
ProgrammingError(1064, .....)


More information about the Python-list mailing list