On Mon, 17 Jun 2013 22:28:47 +0300, Νίκος wrote: > On 17/6/2013 10:19 μμ, John Gordon wrote: >> Print the cur.rowcount attribute, which contains the number of rows >> that were affected by the update. If it's zero, that should tell you >> something. > > > #update file's counter if cookie does not exist cur.execute('''UPDATE > files SET hits = hits + 1, host = %s, lastvisit = > %s WHERE url = %s''', (host, lastvisit, filename) ) > > if cur.rowcount: > print( " database has been affected" ) > > indeed every time i select afilename the message gets printed bu then > again noticing the database via phpmyadmin the filename counter is > always remaining 0, and not added by +1
replase if cur.rowcount: print( " database has been affected" ) with print cur.rowcount() you can also use phpmyadmin to try your sql queries interactively to check the perform as expected before putting them into your code -- Warp 7 -- It's a law we can live with. -- http://mail.python.org/mailman/listinfo/python-list