mysqldb SELECT COUNT reurns 1
SMALLp
pofuk at mzm.hr
Thu Dec 27 15:32:02 EST 2007
Rob Williscroft wrote:
> SMALLp wrote in news:fl10ev$hfb$1 at ss408.t-com.hr in comp.lang.python:
>
>> Hy! I nave another problem I can't solve!
>> <code>
>>
>> import MySQLdb as mysql
>
>> cursor = conn.cursor()
>> sql = "SELECT COUNT(*) FROM " + dataTable
>> res = cursor.execute(sql)
>
> I think you need to do:
> res = cursor.fetchone()[0]
>
>
>> print res
>>
>> <code>
>> It prints 1, and there are 88 rows in table. SELECT works fine, but
>> SELECT COUNT(*) makes problems.
>
> Rob.
Of course! Thanks!
More information about the Python-list
mailing list