Visualizzazione dei risultati da 1 a 2 su 2

Discussione: select...query...join

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

    select...query...join

    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)

    Buonagiornata a tutti

    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,Descrizion
    e_interna,Descrizione_adidas,Taglia,Prez
    zo,Quantita)"&"VALUES('"&Codice_interno&"','"&Codi ce_adidas&"','"&Descrizione_interna&"','"&Descrizi one_adidas&"','"&Taglia&"','"&Prezzo&"','"&Quantit a&"')"


    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

  2. #2
    Utente di HTML.it L'avatar di viki1967
    Registrato dal
    Feb 2003
    Messaggi
    1,757
    è praticamente inutile postare una marea di righe codice che nessuno comprenderà mai, cosa vuoi che ti si possa rispondere?

    cerca di essere preciso nel problema ed a fare delle prove anche con l'aiuto della ricerca del forum; nell'80% dei casi il tuo problema è già stato discusso e risolto.
    A S P : tutto il resto è noia...
    L I N U X : forse mi "converto"...

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.