Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit4.readnews.com!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 17:40:26 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 37 Message-ID: References: NNTP-Posting-Host: panix3.panix.com X-Trace: reader1.panix.com 1371490826 16 166.84.1.3 (17 Jun 2013 17:40:26 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Mon, 17 Jun 2013 17:40:26 +0000 (UTC) User-Agent: nn/6.7.3 Xref: csiph.com comp.lang.python:48542 In Simpleton writes: > Hello again, something simple this time: > After a user selects a file from the form, that sleection of his can be > found form reading the variable 'filename' > If the filename already exists in to the database i want to update its > counter and that is what i'm trying to accomplish by: > ----------- > if form.getvalue('filename'): > cur.execute('''UPDATE files SET hits = hits + 1, host = %s, lastvisit = > %s WHERE url = %s''', (host, lastvisit, filename) ) > ----------- > For some reason this never return any data, because for troubleshooting > i have tried: > ----------------- > data = cur.fetchone() > if data: > print("something been returned out of this"_ > ---------------- An UPDATE statement isn't a query. There are no results to be fetched. If you want to get results, execute a query (usually a SELECT.) Also, that print statement is an obvious syntax error. Please post the actual code you're running; don't type it in from memory. -- 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"