Page 1 of 1

Database driven PHP photo album

Posted: Thu Oct 17, 2002 11:12 am
by Tagore
create table photo (
id integer unsugned auto_increment primary key,
url varchar(20)
);

В url записываем значения типа: image1.gif, image2.gif, image3.gif и т.д.


mysql_connect('host', 'user', 'password');
mysql_select_db('database');
$sql = "SELECT url FROM photo";
$result = mysql_query($sql);

$image_path = "images/";

while ($row = mysql_fetch_array($result))
{
echo "<img src='" . $image_path . $row['url'] . "'>";
}


mysql_connect('host', 'user', 'password');
mysql_select_db('database');
$sql = "SELECT url FROM photo";
$result = mysql_query($sql);

$image_path = "images/";

while ($row = mysql_fetch_array($result))
{
echo "<img src='" . $image_path . $row['url'] . "'>";
}

another try

<?php
mysql_connect('localhost', 'gmarik', 'Photoshop6');
mysql_select_db('aB');
$query = mysql_query("select url,desc from photo limit 0, 16");
while($row = mysql_fetch_array($query){
echo "<img src='$row[0]'><br>$row[1]";
};
?>

I want to build a mysql driven photo album, with thumbnails and links to a php page with the big photo. any ideas? :roll: [/b]

Posted: Thu Oct 17, 2002 3:40 pm
by mr_griff
There are several php scripts that will do exactly what you want already written. Here is a link to one that is full of features:
http://gallery.menalto.com/

Also check out the code gallary at zend.com
http://www.zend.com/codex.php