Adesso sn riuscito a generare il file
[PHP]
$query = mysql_query("
SELECT *
FROM preventivi_clienti
INNER JOIN preventivi_prodotti
ON preventivi_clienti.preventivi_clienti_ses = preventivi_prodotti.ses
INNER JOIN shop_prodotti
ON shop_prodotti.id = preventivi_prodotti.id_prodotto
");
while($result = mysql_fetch_array($query))
{
$id_db = $result['preventivi_clienti_id'];
$id_db= mb_convert_encoding(htmlspecialchars($id_db, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$nome_db = $result['preventivi_clienti_nome'];
$nome_db = mb_convert_encoding(htmlspecialchars($nome_db , ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$cognome_db = $result['preventivi_clienti_cognome'];
$cognome_db= mb_convert_encoding(htmlspecialchars($cognome_db, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$indirizzo_db = $result['preventivi_clienti_indirizzo'];
$indirizzo_db = mb_convert_encoding(htmlspecialchars($indirizzo_db, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$cap_db = $result['preventivi_clienti_cap'];
$cap_db = mb_convert_encoding(htmlspecialchars($cap_db, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$citta_db = $result['preventivi_clienti_citta'];
$citta_db = mb_convert_encoding(htmlspecialchars($citta_db, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$stato_db = $result['preventivi_clienti_stato'];
$stato_db = mb_convert_encoding(htmlspecialchars($stato_db, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$telefono_db = $result['preventivi_clienti_telefono'];
$telefono_db = mb_convert_encoding(htmlspecialchars($telefono_db, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$email_db = $result['preventivi_clienti_email'];
$email_db = mb_convert_encoding(htmlspecialchars($email_db, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$data_db = $result['preventivi_clienti_data'];
$data_db = mb_convert_encoding(htmlspecialchars($data_db, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$note_db = $result['preventivi_clienti_note'];
$note_db = mb_convert_encoding(htmlspecialchars($note_db, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$id_prodotto_db = $result['id_prodotto'];
$id_prodotto_db = mb_convert_encoding(htmlspecialchars($id_prodotto_db, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$qnt_prod_db = $result['qnt'];
$qnt_prod_db = mb_convert_encoding(htmlspecialchars($qnt_prod_db, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$nome_prodotto = $result['nome'];
$nome_prodotto = mb_convert_encoding(htmlspecialchars($nome_prodotto, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$art_prodotto = $result['articolo'];
$art_prodotto= mb_convert_encoding(htmlspecialchars($art_prodotto, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$unita_prodotto = $result['unita'];
$unita_prodotto= mb_convert_encoding(htmlspecialchars($unita_prodotto, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
$prezzo_prodotto = $result['prezzo'];
$prezzo_prodotto= mb_convert_encoding(htmlspecialchars($prezzo_prodotto, ENT_NOQUOTES, 'Windows-1252'), 'UTF-8', 'Windows-1252');
echo "
<Document>
<DocumentType>C</DocumentType>
<CustomerCode>$id_db</CustomerCode>
<CustomerName>$nome_db $cognome_db</CustomerName>
<CustomerAddress>$indirizzo_db</CustomerAddress>
<CustomerPostcode>$cap_db</CustomerPostcode>
<CustomerCity>$citta_db </CustomerCity>
<CustomerProvince></CustomerProvince>
<CustomerCountry>$stato_db </CustomerCountry>
<CustomerVatCode></CustomerVatCode>
<CustomerTel>$telefono_db</CustomerTel>
<CustomerEmail>$email_db</CustomerEmail>
<Date>$data_db</Date>
<Number></Number>
<Total></Total>
<InternalComment>Nessun Acconto</InternalComment>
<CustomField1>$note_db</CustomField1>
<Row>
<Code>$art_prodotto</Code>
<Description>$nome_prodotto</Description>
<Qty>$qnt_prod_db</Qty>
<Um>pz</Um>
<Price>$prezzo_prodotto</Price>
<Discounts>5%</Discounts>
<VatCode>20</VatCode>
</Row>
</Document>";
}
[/PHP]
Il codice funziona, solo che non fà quello che voglio io, adesso vi spiego.
Il codice mi da questo risultato
cliente1
prodotto1
cliente1
prodotto2
cliente1
prodotto3
Io invece vorrei una cosa del genere
cliente1
prodotto1
prodotto2
prodotto3
Il problema penso sia il while..
Mi sapete dare un consiglio su come fare?
Ciau