On Sun, Mar 26, 2017 at 8:24 AM, Νίκος Βέργος <me.on....@gmail.com> wrote: > Τη Κυριακή, 26 Μαρτίου 2017 - 5:19:27 μ.μ. UTC+3, ο χρήστης Ian έγραψε: > >> You need to change the placeholders back. The poster who told you to >> replace them was misinformed. > > okey altered them back to > > 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) ) > > but now the problem is how to exact;y type the Where HOST like "%%%" > > I MEAN HOW TO DIFFERENTIATE '%S' FROM LITERAL '%' character.
The database wrapper won't do substitution into the middle of a string like that. Either concatenate the literal %'s on in the SQL statement or add them to the string before you pass it in, i.e. '%' + domain + '%' or '%%%s%%' % domain or '%{}%'.format(domain). -- https://mail.python.org/mailman/listinfo/python-list