Visualizzazione dei risultati da 1 a 7 su 7

Discussione: Tabelle Mysql...

  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2005
    Messaggi
    54

    Tabelle Mysql...

    Ciao ho due tabelle mysql e vorrei che per ogni campo(a) delle prima tabella mi carichi i campi(1,2,3,...) della seconda tabella...però devono essere associati solo a quell'campo(a).
    Esempio
    Gigi...ha effettuato 10 viaggi,2 trasferte,2 giorni di malattia
    Pippo...ha effettuato 3 viaggi,5 trasferte,7 giorni di malattia
    Qualcuno mi ha suggerito una "query select"....ma non saprei come procedere, essendo un neofita ASP
    Grazie
    Buonagiornata a tutti

  2. #2
    Qui bisogna conoscere SQL in questo caso.
    Una SELECT con in JOIN la seconda tabella.

  3. #3
    Utente di HTML.it
    Registrato dal
    Oct 2005
    Messaggi
    54
    bhe...conosco poco pure SQL...dove posso trovare qualche esempio che possa aiutarmi?
    come dovrebbero essere le stringhe di comando???
    Grazie

  4. #4

  5. #5
    Utente di HTML.it
    Registrato dal
    Oct 2005
    Messaggi
    54

    è in inglese...vabbè rinuncio,forse è meglio che impari qualche altro programma al poso di ASP e Mysql

  6. #6
    Utente di HTML.it
    Registrato dal
    Oct 2005
    Messaggi
    54
    allora..posto il codice...
    primo file

    <table border="0" cellpadding="4" width="100%" cellspacing="1" bgcolor="#660066" height="90" ID="Table1">
    <tr>


    <td width="210" bgcolor="#cccccc" height="29">
    <p align="center"><font class="testobold " size="2" face="Verdana">Data Fatt.</font></td>
    <td width="210" bgcolor="#cccccc" height="29">
    <p align="center"><font class="testobold " size="2" face="Verdana">Fattura</font></td>
    <td width="210" bgcolor="#cccccc" height="29">
    <p align="center"><font class="testobold " size="2" face="Verdana">Importo</font></td>
    <td width="17" valign="middle" align="center" bgcolor="#cccccc" height="29"></td>
    <td width="17" valign="middle" align="center" bgcolor="#cccccc" height="29"></td>
    <td width="17" valign="middle" align="center" bgcolor="#cccccc" height="29"></td>
    </tr>
    <%
    SQL="SELECT * FROM fatture"
    Set rec = Server.CreateObject("ADODB.Recordset")
    Set Rec=Conn.Execute(SQL)
    While Not rec.EOF%>
    <tr>
    <td width="210" bgcolor="#FFFFCC" height="30"><font size="2" face="Verdana"><%=rec("Data_fatt")%></font></td>
    <td width="210" bgcolor="#FFFFCC" height="30"><font size="2" face="Verdana"><%=rec("Fattura")%></font></td>
    <td width="210" bgcolor="#FFFFCC" height="30"><font size="2" face="Verdana"><%=rec("Importo")%></font></td>

    <td width="17" valign="middle" align="center" bgcolor="#FFFFCC" height="30">">[img]cancella.gif[/img]"></td>

    <td width="17" valign="middle" align="center" bgcolor="#FFFFCC" height="30">">[img]modifica.gif[/img]"></td>
    <td width="17" valign="middle" align="center" bgcolor="#FFFFCC" height="30">">[img]articoli.gif[/img]"></td>
    </tr>
    <% rec.MoveNext
    Wend
    rec.close%>
    </center>
    <tr>
    <td width="447" valign="middle" align="left" bgcolor="#660066" colspan="4" height="21">
    <font class="testobianco" size="2" face="Verdana">Aggiungi Fattura</font></td>
    <td width="17" valign="middle" align="right" bgcolor="#660066" height="21">

    </td><td width="17" valign="middle" align="right" bgcolor="#660066" height="21">

    </td>
    </tr>
    </table>

    secondo file


    <form method="post" action="add-process.asp">
    <table border="0" cellpadding="4" width="400" bgcolor="#000000" cellspacing="1" height="142">
    <tr>
    <td width="199" bgcolor="#FFFFCC" height="35"><font size="2" face="Verdana">Data</font></td>
    <td width="199" bgcolor="#FFFFCC" height="35">
    <p align="center"><input name="Data" maxlength="50" size="25"></td>
    </tr>
    <tr>
    <td width="199" bgcolor="#FFFFCC" height="35"><font size="2" face="Verdana">Fattura</font></td>
    </center>
    <td width="199" bgcolor="#FFFFCC" height="35">
    <p align="center"><input name="Fattura" maxlength="50" size="25"></td>
    </tr>
    <center>
    <tr>
    <td width="199" bgcolor="#FFFFCC" height="36"><font size="2" face="Verdana">Importo</font></td>
    <td width="199" bgcolor="#FFFFCC" height="36">
    <p align="center"><input name="Importo" maxlength="50" size="25"></td>
    </tr>
    <tr>
    <td width="199" bgcolor="#FFFFCC" height="36">
    <p align="center"><input type="submit" name="Submit" value="Aggiungi"></td>
    <td width="199" bgcolor="#FFFFCC" height="36"></td>
    </tr>
    </table>


    terzo file""add-process.asp""

    <%Data_fatt=Request.Form("Data")
    Fattura=Request.Form("Fattura")
    Importo=Request.Form("Importo")
    SQL = "INSERT INTO Fatture (Data_fatt,Fattura,Importo)"&"VALUES('"&Data_fatt& "','"&Fattura&"','"&Importo&"')"

    Conn.Execute(SQL)
    Response.Redirect "magazzino.asp"%>



    e fin qui tutto ok...adesso vorrei che ogni prodotto caricato corrisponda alla relativa fattura e che il numero di fattura e la data sia visualizzato sulla schermata dove inserisco i prodotti:


    quarto file



    <table border="0" cellpadding="4" width="100%" cellspacing="1" bgcolor="#660066" height="90"
    ID="Table1">
    <TBODY>
    <TR>
    <TD width="210" bgColor="#cccccc" height="29">
    <P align="center"><FONT class="testobold " face="Verdana" size="2">Fattura</FONT></P>
    </TD>
    <TD width="210" bgColor="#cccccc" height="29">
    <P align="center"><FONT class="testobold " face="Verdana" size="2">Data di Fatt.</FONT></P>
    </TD>
    <TD width="210" bgColor="#cccccc" height="29">
    <P align="center"><FONT class="testobold " face="Verdana" size="2">Codice Interno</FONT></P>
    </TD>
    <TD width="210" bgColor="#cccccc" height="29">
    <P align="center"><FONT class="testobold " face="Verdana" size="2">Codice Adidas</FONT></P>
    </TD>
    <TD width="210" bgColor="#cccccc" height="29">
    <P align="center"><FONT class="testobold " face="Verdana" size="2">Descrizione Interna</FONT></P>
    </TD>
    <TD width="210" bgColor="#cccccc" height="29">
    <P align="center"><FONT class="testobold " face="Verdana" size="2">Descrizione Adidas</FONT></P>
    </TD>
    <TD width="210" bgColor="#cccccc" height="29">
    <P align="center"><FONT class="testobold " face="Verdana" size="2">Taglia</FONT></P>
    </TD>
    <TD width="210" bgColor="#cccccc" height="29">
    <P align="center"><FONT class="testobold " face="Verdana" size="2">Prezzo</FONT></P>
    </TD>
    <TD width="210" bgColor="#cccccc" height="29">
    <P align="center"><FONT class="testobold " face="Verdana" size="2">Quantità</FONT></P>

    </TD>
    <TD width="210" bgColor="#cccccc" height="29"></TD>
    <TD width="210" bgColor="#cccccc" height="29"><P align="center"><FONT class="testobold " face="Verdana" size="2"></FONT></P>
    </TD>
    </TR>
    <%
    SQL="SELECT * FROM magazzino"
    Set rec = Server.CreateObject("ADODB.Recordset")
    Set Rec=Conn.Execute(SQL)
    While Not rec.EOF%>
    <TR>
    <TD width="210" bgColor="#ffffcc" height="30">
    <P align="center">fat</P>
    </TD>
    <TD width="210" bgColor="#ffffcc" height="30">
    <P align="center">dfatt</P>
    </TD>
    <TD width="210" bgColor="#ffffcc" height="30">
    <P align="center"><%=rec("Codice_Interno")%></P>
    </TD>
    <TD width="210" bgColor="#ffffcc" height="30">
    <P align="center"><%=rec("Codice_Adidas")%></P>
    </TD>
    <TD width="210" bgColor="#ffffcc" height="30">
    <P align="center"><%=rec("Descrizione_interna")%></P>
    </TD>
    <TD width="210" bgColor="#ffffcc" height="30"><%=rec("Descrizione_adidas")%></TD>
    <TD width="210" bgColor="#ffffcc" height="30"><%=rec("Taglia")%></TD>
    <TD width="210" bgColor="#ffffcc" height="30"><%=rec("Prezzo")%></TD>
    <TD width="210" bgColor="#ffffcc" height="30"><%=rec("Quantita")%></TD>
    <TD width="210" bgColor="#ffffcc" height="30">
    <P align="center"><FONT face="Verdana" size="2">">[img]cancella.gif[/img]</FONT></P>
    </TD>
    <TD width="210" bgColor="#ffffcc" height="30">
    <P align="center"><FONT face="Verdana" size="2">">[img]modifica.gif[/img] </FONT></P>
    </TD>
    </TR> <% rec.MoveNext
    Wend
    rec.close%>

    <TR>

    <TD vAlign="middle" align="left" width="447" bgColor="#660066" height="21"></TD>
    <TD vAlign="middle" align="left" width="447" bgColor="#660066" height="21"></TD>
    <TD vAlign="middle" align="left" width="447" bgColor="#660066" height="21"><FONT class="testobianco" face="Verdana" size="2"></FONT></TD>
    <TD vAlign="middle" align="left" width="447" bgColor="#660066" height="21"></TD>
    <TD vAlign="middle" align="left" width="447" bgColor="#660066" height="21"></TD>
    <TD vAlign="middle" align="left" width="447" bgColor="#660066" height="21"></TD>
    <TD vAlign="middle" align="left" width="447" bgColor="#660066" height="21"></TD>
    <TD vAlign="middle" align="left" width="447" bgColor="#660066" height="21"></TD>
    <TD vAlign="middle" align="left" width="447" bgColor="#660066" height="21"></TD>
    <TD vAlign="middle" align="left" width="427" bgColor="#660066" colSpan="4" height="21">

    <P align="right"><A title="Aggiungi un nuovo Articolo" href="add-articoli.asp"><FONT class="testobianco" face="Verdana" size="2">Aggiungi
    Prodotto</FONT></A></P>
    </TD>
    </TR>

    <DIV></DIV>
    </TBODY></table>

    quinto file:


    <table border="0" cellpadding="4" cellspacing="1" bgcolor="#660066" height="90" ID="Table2">

    <tr bgColor="#cccccc">
    <td align="center" colSpan="2"><font class="testobold ">INSERISCI UN ARTICOLO</font></td>
    </tr>
    <tr bgcolor="#FFFFCC">
    <td><font class="testonero">CODICE INTERNO</font></td>
    <td ><input type="text" maxLength="50" size="21" value="" name="txtcodice_interno" ID="Text1"></td>
    </tr>
    <tr bgcolor="#FFFFCC">
    <td ><font class="testonero">CODICE ADIDAS</font></td>
    <td ><input type="text" maxLength="50" size="21" value=""name="txtcodice_adidas" ID="Text2"></td>
    </tr>
    <tr bgcolor="#FFFFCC">
    <td><font class="testonero">DESCRIZIONE INTERNA</font></td>
    <td ><input type="text" maxLength="50" value=""size="21" name="txtdescr_interna" ID="Text3"></td>
    </tr>
    <tr bgcolor="#FFFFCC">
    <td ><font class="testonero">DESCRIZIONE ADIDAS</font></td>
    <td ><input type="text" maxLength="50" size="21" value=""name="txtdescr_adidas" ID="Text4"></td>
    </tr>
    <tr bgcolor="#FFFFCC">
    <td><font class="testonero">TAGLIA</font></td>
    <td ><select name="slttaglia">
    <option value="..." selected>Seleziona</option>
    <option value="XS"<%if request.querystring("slttaglia")="XS" then%>selected<%End If%>>XS</option>
    <option value="S"<%if request.querystring("slttaglia")="XS" then%>selected<%End If%>>S</option>
    <option value="M"<%if request.querystring("slttaglia")="XS" then%>selected<%End If%>>M</option>
    <option value="L"<%if request.querystring("slttaglia")="XS" then%>selected<%End If%>>L</option>
    <option value="XL"<%if request.querystring("slttaglia")="XS" then%>selected<%End If%>>XL</option>
    <option value="XXL"<%if request.querystring("slttaglia")="XS" then%>selected<%End If%>>XXL</option>
    </select>
    </td>
    </tr>
    <tr bgcolor="#FFFFCC">
    <td ><font class="testonero">QUANTITÀ</font></td>
    <td ><input type="text" maxLength="50" value=""size="21" name="txtquantita" ID="Text5"></td>
    </tr>
    <tr bgcolor="#FFFFCC">
    <td><font class="testonero">PREZZO UNITARIO €</font></td>
    <td ><input type="text" maxLength="50" size="21"value="" name="txtprezzo" ID="Text6"></td>
    </tr>
    <tr bgColor="#660066">
    <td align="center" colSpan="2"><input type="submit" value="Invia dati" ID="Submit1" NAME="Submit1"></td>
    </tr>
    </table>
    </form>


    sesto file:

    <%
    cod=request.querystring("cod")
    Codice_interno = request.form("txtcodice_interno")
    Codice_adidas = request.form("txtcodice_adidas")
    Descrizione_interna = request.form("txtdescr_interna")
    Descrizione_adidas = request.form("txtdescr_adidas")
    Taglia = request.form("slttaglia")
    Prezzo = request.form("txtprezzo")
    Quantita = request.form("txtquantita")
    %>



    <%



    SQL = "INSERT INTO magazzino (Codice_interno,Codice_adidas,Descrizione_interna, Descrizione_adidas,Taglia,Prezzo,Quantita)"&"VALUE S('"&Codice_interno&"','"&Codice_adidas&"','"&Desc rizione_interna&"','"&Descrizione_adidas&"','"&Tag lia&"','"&Prezzo&"','"&Quantita&"')"


    Conn.Execute(SQL)
    Response.Redirect "articoli.asp"
    %>


    mancano i file...dove si modifica la fattura e quelli dove si modifica l'articolo...


    Bhe...grazie comunque vada

  7. #7
    Utente di HTML.it L'avatar di 99eros9
    Registrato dal
    Jan 2003
    Messaggi
    2,637
    La sintassi é universale, anche se non conosci l'inglese é piuttosto comprensibile purché individui la parte della presentazione relativa al join.
    Sia neofita che professionista, si dovrebbe sempre cercare di imparare qualcosina, no? Scusa, non é una paternale, tutti dobbiamo continuamente ad imparare in questo campo e ti consiglio di iniziare a farlo.
    Sql é fondamentale, se non vuoi spendere troppi soldi (Sql Guida Completa - McGraw-Hill) ti consiglio un tascabile a 10.70 euro edito da Mondadori Informatica di Michael J. Hernandez e John L. Viescas intitolato I Portatili SQL.



    P.s.
    Il cross posting é vietato dal regolamento del forum. è inutile aprire un 3d sulla stessa discussione
    Tala är silver men tiga är guld!
    Pubblica il tuo curriculum
    Segnala il tuo sito
    Ancl

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.