Lydia Richardson Lydia Richardson - 1 year ago 69
MySQL Question

Database information not lining up in a table (php/sql)

When using CSS for my DetailsTable the information I am getting from the database is not being displayed correctly in the table. All of that information is getting bunched up together and therefore isn't being laid out as a table.

If anyone could suggest why the information I am trying to get isn't being laid out in a table form that would be much appreciated

<div id="DetailsTable" >


$stmt = $conn->prepare("SELECT, shoes.images, shoes.description, shoes.price, types.typeOfShoe, types.fabric, types.colour, 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 = :id");


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>";

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

The CSS code is below.

body {
background-color: lemonchiffon;

#DetailsTable {

border-collapse: collapse;
width: 100%;

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

display: block;
margin: auto;
width: 50%;
height: 10px;
clear: both;

Answer Source

You have closed the</table> tag before the php code, that maybe the problem

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download