Visualizzazione dei risultati da 1 a 3 su 3

Discussione: Counter Click

  1. #1

    Counter Click

    Dopo svariate prove e numerosissimi errori di ogni genere e natura.. ho rinunciato a scrivere io il codice di un banalissimo counter per i click...

    Ho sfruttato quello che c'è nella sezione dedicata su Html.it.. dopo aver adattato i percorsi del db... ecco cosa mi succede...:

    in locale
    il primo file funziona perfettamente, clicco sul link, mi inserisce i dati nel db e poi mi rimanda all'url corrispondente al link....
    il secondo file dopo aver inviato la query mi da sto errore:
    Tipo di errore:

    Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
    [Microsoft][Driver ODBC Microsoft Access] Istruzione SQL non valida. Prevista 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT' o 'UPDATE'.
    /calagavetta.it/click/click_view.asp, line 43
    alla riga 43 corrisponde sto codice:

    rs.Open sql, cn

    che è la stringa che apre il recordset

    ..........
    una volta pubblicato tutto ed aver adattato il percorso del db... mi da sto errore..:
    il primo file:

    Microsoft OLE DB Provider for ODBC Drivers error '80004005'
    [Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable query.
    /click/clicks.asp, line 54
    codice della linea 54:
    rs.open sql, cn

    il secondo file invece mi da lo stesso errore che in locale...


    Io ora dico... sono così negato per sto mestiere... oppure capita ad altri sto problema ?? :master:

  2. #2
    Utente di HTML.it L'avatar di buji
    Registrato dal
    Nov 2002
    Messaggi
    178
    Posta il codice
    Buji

  3. #3
    file clicks.asp

    codice:
    <% 
    ' Value for the url being requested
    url=trim(request.querystring("url"))
    
    ' if no url is detected then show then
    ' show a page with links 
    if url="" then %>
    <html>
    <title>CodeAve.com(Count Clicks to a Db)</title>
    <head>
    <base target="_blank">
    </head>
    <body bgcolor="#FFFFFF">
    
    Yahoo
    
    
    AOL
    
    
    Excite
    
    
    Mail2Web
    
    
    ASPIn
    
    
    SAS
    
    </body>
    </html>
    <% 
    ' if there is a url value detected add it to the db
    ' and redirect the browser to the url
    else 
    %>
    
    <%
    
    ' Varible for the PC IP address
    ip=request.servervariables("remote_addr")
    
    ' name of the db that will track the clicks
    accessdb="/calagavetta.it/mdb-database/clienti.mdb" 
    
    ' Build a connection to the db
    cn="DRIVER={Microsoft Access Driver (*.mdb)};"
    cn=cn & "DBQ=" & server.mappath(accessdb)
    
    ' Create a server record set object
    set rs = server.createobject("ADODB.Recordset")
    
    ' SQL statement that will insert the url and the ip address
    sql = "insert into clicks (url,ip) values('"& url &"','"& ip &"')" 
    
    ' insert the values into the db
    rs.open sql, cn
    
    ' kill the recordset  
    set rs=nothing
    
    ' redirect to the url 
    response.redirect url 
    %>
    
    
    <% end if ' end check for a url value %>
    file click_view.asp

    codice:
    <html>
    <title>CodeAve.com(Click Through Display)</title>
    <body bgcolor="#FFFFFF">
    <%' Check to see if there is any input
    ' if not display the form for input
    u_input=request.form("u_input")
     %>
    <center>
    <form action="<%= request.servervariables("script_name")%>" method="post">
    <input type="submit" value="View">
    <% if u_input <> "" then %>
    Clicks by
    <% else %>
    Select a Report
    <% end if %>
    
    <select size="1" name="u_input">
    <option <% if u_input="URL" then response.write
     "selected " end if %>value="URL">URL</option>
    <option <% if u_input="Day" then response.write
     "selected " end if %>value="Day">Day</option>
    <option <% if u_input="Month" then response.write
     "selected " end if %>value="Month">Month</option>
    <option <% if u_input="IP" then response.write
     "selected " end if %>value="IP">IP</option>
    </select>
    </form>
    </center>
    
    <%' When there is input display the data
    if u_input <> "" then
    
    ' Name of the Access db
    accessdb="/calagavetta.it/mdb-database/clienti" 
    
    ' Connection to the db
    cn="DRIVER={Microsoft Access Driver (*.mdb)};"
    cn=cn & "DBQ=" & server.mappath(accessdb)
    
    ' Create a server record set object
    set rs = server.createobject("ADODB.Recordset")
    
    
    sql = "Clicks_by_" & u_input
    
    ' Execute the sql 
    rs.Open sql, cn
    %>
    
    <table border=3 align=center>
    <tr>
    <% ' Write out all the elements requested in the 
    ' sql statement as table headers
    for each element in rs.fields%>
    <th><%= ucase(element.name) %></th>
    <% next
    ' End table headers  %>
    </tr>
    <tr>
    <% ' Write out all the values in the record  
    do while not rs.eof 
    for each element in rs.fields %>
    <td align=left><%= rs(element.name) %></td>
    <% 
    next
    ' end of record %>
    </tr>
    <% ' Move to the next record
    rs.movenext
    ' Loop to the beginning
    loop%>
    </table>
    
    <% end if 'End check for user input %>
    </body>
    </html>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.