Hi,
I am trying to display images from my db with the following code..
<?php
include_once("scripts/connect.php");
if ($q == "All Images") {
$sql = mysql_query("SELECT * FROM gallery");
$q = "All Images";
} else {
$sql = mysql_query("SELECT * FROM gallery WHERE caption LIKE '%$q%'");
}
$limit = 7;
$count = 0;
while($row = mysql_fetch_array($sql)) {
$caption = $row['caption'];
$id = $row['id'];
$num_results = mysql_num_rows($sql);
if($num_results == 0) {
echo "<tr><td><font face='Arial'><b>Sorry, no results found...</b></font></td></tr>";
} else {
if($count < $limit) {
if ($count ==0) {
echo "<tr>";
}
echo "<td style='border-style:none; border-width:medium;'>";
echo "<p align='center'>";
echo "<a href='cms/gallery/$id.jpg' title='$caption' rel='lightbox[PhotoGallery1]'>";
echo "<img id='$id' style='opacity:0.65' onmouseover=\"Animate('$id', '', '', '', '', '100', 250);return
false;\" onmouseout=\"Animate('$id', '', '', '', '', '65', 250);return false;\" src='cms/gallery/$id.jpg' width='100' >";
echo "</a>";
echo "</td>";
}
else {
$count == 0;
echo "</tr><td style='border-style:none; border-width:medium;'>";
echo "<p align='center'>";
echo "<a href='cms/gallery/$id.jpg' title='$caption' rel='lightbox[PhotoGallery1]'>";
echo "<img id='$id' style='opacity:0.65' onmouseover=\"Animate('$id', '', '', '', '', '100', 250);return
false;\" onmouseout=\"Animate('$id', '', '', '', '', '65', 250);return false;\" src='cms/gallery/$id.jpg' width='100' >";
echo "</a>";
echo "</td>";
}
$count++;
}}
echo "</tr>";
?>
But when I execute it, it display first seven results in columns and the others 1 in 1 row... PLZ HELp...