photo_gallery.php
<?php
// Connect database.
mysql_connect("localhost","root","yourpassword");
mysql_select_db("sample");
echo '<table align="center" border="0"><tr><td align="center" colspan="3"><font face="tahoma" size="2">Gallery</font></td></tr>';
$sql = mysql_query("SELECT * FROM table1");
$i=1;
while($row = mysql_fetch_array($sql))
{
if ($i==1)
echo "<tr>";
echo "<td align='center'>";
echo "<table border='0' width='1' align='center'>";
echo "<tr><td align='center'><img src=".$row['photo']." width='100' height='100'></td></tr>";
echo "<tr>";
echo "<td align='center'>".$row['photo']."</td>";
echo "</tr>";
echo "</table>";
echo "</td>";
if ($i==3)
{
$i=0;
echo "</tr>";
}
$i ;
}
?>
Sample Output:
No comments:
Post a Comment