Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!panix!gordon From: John Gordon Newsgroups: comp.lang.python Subject: Re: Updating a filename's counter value failed each time Date: Mon, 17 Jun 2013 20:44:03 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 27 Message-ID: References: NNTP-Posting-Host: panix3.panix.com X-Trace: reader1.panix.com 1371501843 9188 166.84.1.3 (17 Jun 2013 20:44:03 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Mon, 17 Jun 2013 20:44:03 +0000 (UTC) User-Agent: nn/6.7.3 Xref: csiph.com comp.lang.python:48563 In Alister writes: > > #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() rowcount isn't a method call; it's just an attribute. You don't need the parentheses. -- John Gordon A is for Amy, who fell down the stairs gordon@panix.com B is for Basil, assaulted by bears -- Edward Gorey, "The Gashlycrumb Tinies"