[Tutor] Searching for email id in MySQL giving wrong results
python at venix.com
Mon Jan 23 21:16:08 CET 2006
On Mon, 2006-01-23 at 19:46 +0000, Alan Gauld wrote:
> >> >> wrong_string = '''SELECT s FROM t WHERE id=%s''' , (email_id)
> >> >
> >> The OP must replace the comma with a % character for the string
> >> substitution to take place.
> > The wrong_string line was lifted from the following code in the OP.
> > entry = db.cursor()
> > entry.execute("""SELECT * FROM contact WHERE email_id = %s""",
> > (s_email,))
> Ah I see. Yes that's a different proposition entirely!
> I really should read the whole thread before jumping in... :-(
> Alan G.
Well I created the trap by not pasting in the execute call and posting
what was on its face an invalid piece of Python coding.
More information about the Tutor