i am tryn to display images from a folder and details from the database but the images display in a row not in a column as i want thm to be.please experts help me
below is the code
below is the code
Code:
<?php
$conn= mysql_connect("localhost","root","lesego");
if(!$conn)
{
die('Could not connect: ' .mysql_error());
}
mysql_select_db("exhibition", $conn);
$path='livestock/';
$dir_handle = @opendir($path) or die("Unable to open folder");
$result= mysql_query ("SELECT * from livestock");
if($result){
echo '';
}
else{
echo"Invalid query: " . mysql_error();
}
echo "<table border='1'>";
echo "<tr><th>bid</th><th>breed</th><th>colour</th><th>dob</th><th>photo</th>";
while($row=mysql_fetch_array($result))
{//prints out the contents of each row into a table
echo"<tr><td>";
echo $row['bid'];
echo"</td><td>";
echo $row['breed'];
echo"</td><td>";
echo $row['colour'];
echo"</td><td>";
echo $row['dob'];
echo"</td>";
while (false !== ($file = readdir($dir_handle))) {
if($file == "index.php")
continue;
if($file == ".")
continue;
if($file == "..")
continue;
echo"<td>";
echo"<img src='$path/$file' alt='$file' height=100 width=100><br/></td>";
}
}
echo "</tr>";
echo "</td>";
echo "</table>";
mysql_close($conn);
?>
Comment