Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'example:': 0.03; '-----------': 0.05; 'data:': 0.09; 'filename': 0.09; 'assume': 0.14; '%s,': 0.16; '(host,': 0.16; 'debugging,': 0.16; 'filename)': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'hits': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'really?': 0.16; 'selects': 0.16; 'subject:failed': 0.16; 'tried:': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'trying': 0.19; 'seems': 0.21; 'print': 0.22; 'header:User-Agent:1': 0.23; 'entries': 0.24; 'exists': 0.24; 'header:In-Reply-To:1': 0.27; 'record': 0.27; 'host': 0.29; 'returned': 0.30; "i'm": 0.30; 'time:': 0.31; 'file': 0.32; 'subject:time': 0.33; 'table': 0.34; 'something': 0.35; 'data,': 0.36; 'form,': 0.38; 'to:addr:python-list': 0.38; 'files': 0.38; 'skip:- 10': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'simple': 0.61; 'by:': 0.65; 'header:Reply-To:1': 0.67; 'reply- to:no real name:2**0': 0.71; 'reply-to:addr:python.org': 0.84 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.1 cv=KrN0hwmN c=1 sm=1 tr=0 a=0nF1XD0wxitMEM03M9B4ZQ==:117 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=0Bzu9jTXAAAA:8 a=oyR3mlnJdzkA:10 a=WOYJk9YmNnIA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=HDl4q-BBNugA:10 a=iGp9FgqAZE6CSDv63ZkA:9 a=wPNLvfGTeEIA:10 X-AUTH: mrabarnett:2500 Date: Mon, 17 Jun 2013 18:40:28 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Updating a filename's counter value failed each time References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: python-list@python.org List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 46 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1371490821 news.xs4all.nl 15897 [2001:888:2000:d::a6]:58642 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:48541 On 17/06/2013 17:39, Simpleton wrote: > 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"_ > ---------------- > > Since for sure the filename the user selected is represented by a record > inside 'files' table why its corresponding counter never seems to get > updated? > You say "for sure". Really? Then why isn't it working as you expect? When it comes to debugging, """assumption is the mother of all ****-ups""" [insert relevant expletive for "****"]. Assume nothing. What is the value of 'filename'? What are the entries in the 'files' table? Print them out, for example: print("filename is", ascii(filename)) or write them into a log file and then look at them.