Updating a filename's counter value failed each time
Alister
alister.ware at ntlworld.com
Mon Jun 17 16:39:08 EDT 2013
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.
More information about the Python-list
mailing list