====================================
# if first time for webpage; create new record( primary key is automatic, hit is defaulted ), if page exists then update record cur.execute('''INSERT INTO counters (url) VALUES (%s) ON DUPLICATE KEY UPDATE hits = hits + 1''', page )
# get the primary key value of the new added record
cID = cur.lastrowid


# find out if visitor has downloaded torrents in the past
        cur.execute('''SELECT torrent FROM files WHERE host = %s''', host )
        data = cur.fetchall()

        downloads = []
        if data:
                for torrent in data:
                        downloads.append( torrent )
        else:
                downloads.append( 'None Yet' )

                
# add this visitor entry into database
cur.execute('''INSERT INTO visitors (counterID, refs, host, city, useros, browser, visits, downloads) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)''', (cID, refs, host, city, useros, browser, visits, downloads) )
====================================


Hello,
In my attempt to add as an extra column key the possible downloads of the current visitor( based on its hostname to identify him) i have wrote the above code to try to do so.

I'am afraid something its not working as i expect it to work.
Where is my mistake?
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to