2016-11-24 4 views
1

Wenn ich CSS für meine DetailsTable verwende, werden die Informationen, die ich von der Datenbank erhalte, nicht korrekt in der Tabelle angezeigt. All diese Informationen werden zusammengebündelt und werden daher nicht als Tisch ausgelegt.Datenbankinformationen, die nicht in einer Tabelle angezeigt werden (php/sql)

Wenn jemand könnte vorschlagen, warum die Informationen, die ich zu bekommen habe nicht versucht, in Tabellenform angelegt werden, die viel

</head> 
<body> 
<div id="DetailsTable" > 
    <table> 
     <tr> 
      <th>Name</th> 
      <th>TypeOfShoe</th> 
      <th>Description</th> 
      <th>Price(£)</th> 
      <th>Fabric</th> 
      <th>Colour</th> 
      <th>Brand</th> 

     </tr> 
    </table> 
    <?php 
    $shoesID=$_GET['id']; 

    $stmt = $conn->prepare("SELECT shoes.name, shoes.images, shoes.description, shoes.price, types.typeOfShoe, types.fabric, types.colour, brands.name AS bname FROM shoes INNER JOIN types on types.types_id = shoes.type_id INNER JOIN brands on brands.brands_id = shoes.brands_id 
    WHERE shoes.id = :id"); 

    $stmt->bindValue(':id',$shoesID); 
    $stmt->execute(); 

    if ($shoes=$stmt->fetch()){ 
     echo "<td>".$shoes['name']."</td>"; 
     echo "<td>".$shoes['typeOfShoe']."</td>"; 
     echo "<td>".$shoes['description']."</td>"; 
     echo "<td>".$shoes['price']."</td>"; 
     echo "<td>".$shoes['fabric']."</td>"; 
     echo "<td>".$shoes['colour']."</td>"; 
     echo "<td>".$shoes['bname']."</td>"; 
    } 

    $conn=NULL; 
    ?> 
    <br> <br/> 
    <div id="Image" > 
     <img src="<?php echo $shoes['images']; ?>" height="500px" width="500px" /> 
    </div> 
</div> 

Der CSS-Code ist unten geschätzt werden würde.

body { 
background-color: lemonchiffon; 
}   

#DetailsTable { 

border-collapse: collapse; 
width: 100%; 
} 

th, td { 
text-align: left; 
padding: 8px; 
} 



#Image{ 
display: block; 
margin: auto; 
width: 50%; 
height: 10px; 
clear: both; 
} 

Antwort

0

Sie haben geschlossen den </table> Tag vor dem PHP-Code, dass vielleicht das Problem

0
</head> 
<body> 
<div id="DetailsTable" > 
    <table> 
     <tr> 
      <th>Name</th> 
      <th>TypeOfShoe</th> 
      <th>Description</th> 
      <th>Price(£)</th> 
      <th>Fabric</th> 
      <th>Colour</th> 
      <th>Brand</th> 

     </tr> 
    <?php 
    $shoesID=$_GET['id']; 

    $stmt = $conn->prepare("SELECT shoes.name, shoes.images, shoes.description, shoes.price, types.typeOfShoe, types.fabric, types.colour, brands.name AS bname FROM shoes INNER JOIN types on types.types_id = shoes.type_id INNER JOIN brands on brands.brands_id = shoes.brands_id 
    WHERE shoes.id = :id"); 

    $stmt->bindValue(':id',$shoesID); 
    $stmt->execute(); 

    if ($shoes=$stmt->fetch()){ 
    echo '<tr>'; 
     echo "<td>".$shoes['name']."</td>"; 
     echo "<td>".$shoes['typeOfShoe']."</td>"; 
     echo "<td>".$shoes['description']."</td>"; 
     echo "<td>".$shoes['price']."</td>"; 
     echo "<td>".$shoes['fabric']."</td>"; 
     echo "<td>".$shoes['colour']."</td>"; 
     echo "<td>".$shoes['bname']."</td>"; 
    echo '</tr>'; 
    } 

    $conn=NULL; 
    ?> 
    </html> 
    <br> <br/> 
    <div id="Image" > 
     <img src="<?php echo $shoes['images']; ?>" height="500px" width="500px" /> 
    </div> 
</div> 
Verwandte Themen