Updating a filename's counter value failed each time

Νίκος support at superhost.gr
Mon Jun 17 13:51:13 EDT 2013


On 17/6/2013 8:40 μμ, MRAB wrote:
> 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.
>
Yes i have tried to print it and correct.
for example i have selected a filename just now from

filename is Σκέψου έναν αριθμό.exe

he is the actual filenames valeus from database:

http://i.imgur.com/GxIMW4C.png


Seems like the value of the database isnt being matched with the 
'filename' var's value that why the update never return any data.
i wonder why the update never happens!

-- 
What is now proved was at first only imagined!



More information about the Python-list mailing list