On Dec 28, 7:03 am, SMALLp <[EMAIL PROTECTED]> wrote: > Hy! I nave another problem I can't solve! > <code> > > import MySQLdb as mysql > > connectionString = {"host":"localhost", "user":"root", > "passwd":"pofuck", "db":"fileshare"} > dataTable = "files" > conn = mysql.connect(host=connectionString["host"], > user=connectionString["user"], passwd=connectionString["passwd"], > db=connectionString["db"]) > > cursor = conn.cursor() > sql = "SELECT COUNT(*) FROM " + dataTable > res = cursor.execute(sql) > print res > > <code> > It prints 1, and there are 88 rows in table.
What makes you think that it should return 88? > SELECT works fine, but In what sense does a bare "SELECT" work fine?? > SELECT COUNT(*) makes problems. > > Help! Thanks in advance! Consider helping yourself, e.g.: (1) search the web for "mysqldb tutorial" (2) read the MySQLdb documentation (3) read http://www.python.org/dev/peps/pep-0249/ You need to use one of the cursor.fetchXXXX methods to get your results. The result from a call to cursor.execute is NOT defined in the Python DBAPI. If you are interested in portability of your code across database software, you should not rely on it. The value 1 probably just means that the execute call succeeded. Do read carefully the descriptions of what is returned by each of the cursor.fetchXXXX methods. -- http://mail.python.org/mailman/listinfo/python-list