Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 13
  1. #1

    impostare un limite di contatore

    ho un database con il campo id e voglio che gli utenti si registrino fino al numero 60, cioè se l'id è 61 al posto dell'inserimento nel database, deve uscire un messaggio che dice che è stato raggiunto il limite e non fa registrare

    il codice è il seguente:

    <%
    Dim conn
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & server.MapPath("mdb-database/bingo.mdb")
    sql = "SELECT * FROM utenti WHERE email = '" & request.Form("email") & "'"
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.Open sql, conn, 3, 3

    If rs.EOF then

    rs.AddNew
    rs("nome") = request.Form("nome")
    rs("cognome") = request.Form("cognome")
    rs("indirizzo") = request.Form("indirizzo")
    rs("citta") = request.Form("citta")
    rs("provincia") = request.Form("provincia")
    rs("email") = request.Form("email")
    rs("password") = request.Form("password")
    rs.Update
    RS.Close
    Set RS=Nothing
    conn.Close
    Set conn=Nothing


    Else

    Response.Write("User gi&aacute; esistente")
    Response.End
    RS.Close
    Set RS=Nothing
    conn.Close
    Set conn=Nothing



    end if
    %>

  2. #2
    ma la domanda?

    ps
    ma il codice che hai postato fa quello che chiedi? non dovrebbe

  3. #3
    PRIMA di inserire esegui una SELECT COUNT(*) e vedi

  4. #4
    IL CODICE CHE HO INOLTRATO FA SOLO L'INSERIMENTO DEI CONTINUTI DEL FORM (CHE NON HO POSTATO) CON CONTROLLO SE ESISTE GIA' L'EMAIL

    MI MANCA SOLO IL CONTROLLO SE L'ID è 60 SI DEVE FERMARE


    PS: PER OPTIME MA SE METTO SELECT COUNT (*) CHE COSA CAMBIA?

  5. #5
    IL CODICE MANCANTE E' QUESTO: <form method="post" name="form_user" onSubmit="return controllalog(this)">
    <table width="100%" border="0">
    <tr>
    <td><div align="center"></div></td>
    </tr>
    <tr>
    <td><H1 align="center"><font size="2">INSERISCI I DATI NEL DATABASE</font></H1>
    <table width="100" border="0" align="center">
    <tr>
    <td>Nome</td>
    <td valign="top">
    <input type="text" name="nome" id="nome">
    </td>
    </tr>
    <tr>
    <td>Cognome</td>
    <td valign="top"><input type="text" name="cognome" id="cognome"></td>
    </tr>
    <tr>
    <td>Indirizzo</td>
    <td valign="top"><input type="text" name="indirizzo" id="indirizzo"></td>
    </tr>
    <tr>
    <td>Citt&agrave;</td>
    <td valign="top"><input type="text" name="citta" id="citta"></td>
    </tr>
    <tr>
    <td>Provincia</td>
    <td valign="top"><input type="text" name="provincia" id="provincia"></td>
    </tr>
    <tr>
    <td>Email</td>
    <td valign="top"><input type="text" name="email" id="email"></td>
    </tr>
    <tr>
    <td>Password</td>
    <td valign="top"><input type="text" name="password" id="password"></td>
    </tr>
    </table>
    <p align="center">



    <input name="submit" type="submit" value="Iscriviti">
    </p>
    </td>
    </tr>
    </table>
    </form>

  6. #6
    Originariamente inviato da bbgol
    IL CODICE CHE HO INOLTRATO FA SOLO L'INSERIMENTO DEI CONTINUTI DEL FORM (CHE NON HO POSTATO) CON CONTROLLO SE ESISTE GIA' L'EMAIL

    MI MANCA SOLO IL CONTROLLO SE L'ID è 60 SI DEVE FERMARE


    PS: PER OPTIME MA SE METTO SELECT COUNT (*) CHE COSA CAMBIA?
    a pippo, che cappero te urli?

    non ho detto "metti una count", ho detto "esegui una count"

  7. #7
    pardon mi è scappato il caps lock...scusa l'ignoranza ma come si esegue una count

  8. #8
    sql = "SELECT COUNT(*) FROM utenti"
    Set rs = Server.CreateObject("ADODB.Recordset")
    Set RS = Conn.Execute SQL
    quanti=rs(0)

  9. #9
    stasera sto esaurito mi saprestri indicare dove inserirlo

    grazie e scusami

  10. #10
    inseriscilo dove ti serve. non conosco il tuo programma

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.