MySQLdb problem

gyrcom

08-09-2008 04:51:52

I have been using a MySQL database with ogre and I have run into something that is puzzling.

the first c.execute works and the second does not. What the heck am I doing wrong?

c.execute("""SELECT * FROM HAA""")

print c.fetchone()

c.execute ("""SELECT * FROM '%s' """, ("HAA",))

print c.fetchone()

Thanks

Zyzle

08-09-2008 17:57:47

Read up on how to use string formating.

"""SELECT * FROM %s""" % ("HAA",) is what you're looking for i think

gyrcom

08-09-2008 19:01:06

That is the answer, Thanks.
The examples I found on the net did not have that percent sign.
Thanks again