help with mysql cursor.execute()

William Gill noreply at gcgroup.net
Sun Aug 14 15:28:04 EDT 2005


I have been trying to pass parameters as indicated in the api.
when I use:

   sql= 'select * from %s where cusid = %s ' % name,recID)
   Cursor.execute(sql)

it works fine, but when I try :

   sql= 'select * from %s where cusid like %s '
   Cursor.execute(sql,(name,recID))

or

   sql= 'select * from ? where cusid like ? '
   Cursor.execute(sql,(name,recID))

it fails.

Can someone help me with the semantics of using parameterized queries?

Bill



More information about the Python-list mailing list