a question about mysqldb
fredrik at pythonware.com
Thu Aug 14 17:41:13 CEST 2008
> a simple problem but I do not know why...:(, could anyone help me?
> MySQLdb nominally uses just the %s placeholder style, in my script, i
> got error if you want to use placeholder(%s) for table name:
Placeholders are supposed to be used for *values*, not other parts of
the SQL statement. To insert table names, column names and stuff like
that, use Python-level formatting.
table = "tmp"
sql = "select tID,tNote from " + table + " where tID=%s"
param = 
> But sql worked but the I got no query result:
> >>> >>> str="select tID,tNote from tmp where %s = %s"
> >>> >>> e=["tID",int(1)]
the string value "tID" doesn't match an integer with the value 1, so
More information about the Python-list