Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    Problema con tabella ( ancora :-( )

    Ciao a tutti, sto realizzando uno script che popola con un ciclo while una tabella....
    la tabella è questa

    codice:
      <table width="412" border="0">
        <tr>
          <th width="149" height="34" bordercolor="#0066FF" scope="row">Offerta n: </th>
          <td width="253">45</td>
        </tr>
        <tr>
          <th height="31" scope="row">Foto</th>
          <td>http:</td>
        </tr>
        <tr>
          <th height="21" scope="row">Nome lotto/Codice</th>
          <td>lbf56</td>
        </tr>
        <tr>
          <th height="21" scope="row">Categoria</th>
          <td>monete</td>
        </tr>
        <tr>
          <th height="33" scope="row">Descrizione</th>
          <td>ottima moneta</td>
        </tr>
        <tr>
          <th height="23" scope="row">Prezzo</th>
          <td>125 &euro; </td>
        </tr>
        <tr>
          <th height="21" scope="row">Note : </th>
          <td>ottimo</td>
        </tr>
        <tr>
          <th height="33" scope="row">Data inserzione :</th>
          <td>14/89/28</td>
        </tr>
        <tr>
          <th height="21" bgcolor="#0066CC" scope="row"></th>
          <td bgcolor="#0066CC"><div align="right" class="Stile1">Ordina Subito quest'offerta&lt;&lt; </div></td>
        </tr>
      </table>
    Ho messo dei dati a caso per indicare i valori....
    poi ho realizzato un file php in cui c'è l'estrazione dei dati e il ciclo while cosi :

    codice:
    <?
    include("connessione.inc.php");
    $query = "SELECT foto, data, id, categoria, codice, descrizione, prezzo, note FROM offerte ORDER BY id DESC LIMIT 5";
    $result = mysql_query($query, $db); 
    echo "<table width=\"412\" border=\"1\">
    <tr>
    <th width=\"149\" height=\"34\" bordercolor=\"#0066FF\" scope=\"row\">Offerta n:</th>
    <th height=\"31\" scope=\"row\">Foto</th>
    <th height=\"21\" scope=\"row\">Nome lotto/Codice</th>
    <th height=\"21\" scope=\"row\">Categoria</th>
    <th height=\"33\" scope=\"row\">Descrizione</th>
    <th height=\"23\" scope=\"row\">Prezzo</th>
    <th height=\"21\" scope=\"row\">Note : </th>
    <th height=\"33\" scope=\"row\">Data inserzione :</th>
    </tr>";
    while ($row = mysql_fetch_array($result)) {
    echo "<tr> 
    <td width=\"253\">$row[id]</td>
    <td>$row[foto]</td> 
    <td>$row[codice]</td>
    <td>$row[categoria]</td> 
    <td>$row[descrizione]</td> 
    <td>€ $row[prezzo]</td> 
    <td>$row[note]</td>
    <td>$row[data]</td> 
    </tr> ";
    }echo "</table>"; 
    ?>
    mi crea la tabella...ma nn viene come la voglio io, cioè uguale a quella che ho postato sopra...dove sbaglio???grazie mille ciauz a tutti

  2. #2
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    E come viene ? Puoi postare la parte del sorgente html ?

  3. #3
    ecco quello che mi visualizza come tabella :

    <table width="412" border="1">
    <tr>
    <th width="149" height="34" bordercolor="#0066FF" scope="row">Offerta n:</th>
    <th height="31" scope="row">Foto</th>
    <th height="21" scope="row">Nome lotto/Codice</th>
    <th height="21" scope="row">Categoria</th>
    <th height="33" scope="row">Descrizione</th>
    <th height="23" scope="row">Prezzo</th>
    <th height="21" scope="row">Note : </th>
    <th height="33" scope="row">Data inserzione :</th>
    </tr><tr>
    <td width="253">1</td>
    <td></td>
    <td>LBF67</td>
    <td>Francobolli</td>
    <td>Splendido stato, Regno d'Italia 1897</td>
    <td>€ 125.00</td>
    <td></td>
    <td>6/1/2005</td>
    </tr> </table>

    non è come quella da cui ero partito ! quella la aveva il titolo dei campi a sinistra , questa è orientata diversamente! come mai? grazie mille risp

  4. #4
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,372
    Dovrebbe assomigliare a questo....


    codice:
    include("connessione.inc.php");
    $query = "SELECT foto, data, id, categoria, codice, descrizione, prezzo, note FROM offerte ORDER BY id DESC LIMIT 5";
    $result = mysql_query($query, $db); 
    echo "<table width=\"412\" border=\"1\">";
    while ($row = mysql_fetch_array($result)) {
    echo "<tr> 
    <th width=\"149\" height=\"34\" bordercolor=\"#0066FF\" scope=\"row\">Offerta n:</th> 
    <td width=\"253\">$row[id]</td> 
    </tr>
    <tr> 
    <th height=\"31\" scope=\"row\">Foto</th> 
    <td>$row[foto]</td> 
    </tr>
    
    <tr> 
    <th height=\"21\" scope=\"row\">Nome lotto/Codice</th> 
    <td>$row[codice]</td> 
    </tr>
    
    <tr> 
    <th height=\"21\" scope=\"row\">Categoria</th> 
    <td>$row[categoria]</td> 
    </tr>
    
    <tr> 
    <th height=\"33\" scope=\"row\">Descrizione</th> 
    <td>$row[descrizione]</td> 
    </tr>
    
    <tr> 
    <th height=\"23\" scope=\"row\">Prezzo</th> 
    <td>€ $row[prezzo]</td> 
    </tr>
    
    <tr> 
    <th height=\"21\" scope=\"row\">Note : </th> 
    <td>$row[note]</td> 
    </tr>
    
    <tr> 
    <th height=\"33\" scope=\"row\">Data inserzione :</th> 
    <td>$row[data]</td> 
    </tr>";
    }
    
    echo "</table>";

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.