hand-coded, works but not how i want it 2-full code & my
Posted: Mon Jan 19, 2004 12:10 pm
ok, i started developing a gallery system today that basically could be done in html but i dont want my server having 30000000 useless pages, so i started developing a PHP/MySQL gallery and its nearly finished heres all the code
MySQL Infrastructure
PHP Code
now as you can see from the HTML the site should look like this
PICTURE 1 PICTURE 2 ----------> picture 4
name name
resolution resolution
file size file size
PICTURE 5 --------------------------> PICTURE 8 etc
but it all appears the same like this:
PICTURE 1 PICTURE 1 PICTURE PICTURE 1
name etc etc
PICTURE 2 PICTURE 2 PICTURE 2
so basically it is only repeating on the next row, i have tried various HTML setups but cannot get this effect however i know it can be done because google does it (not with PHP but nevertheless)
any ideas guys?
MySQL Infrastructure
Code: Select all
CREATE TABLE details (
filepath varchar(100) NOT NULL default '',
filename varchar(30) default NULL,
person varchar(30) NOT NULL default '',
resolution varchar(12) default NULL,
pictureID varchar(4) NOT NULL default '',
rating varchar(5) default NULL,
thumbnail varchar(100) NOT NULL default '',
status varchar(100) NOT NULL default '',
filesize smallint(5) unsigned NOT NULL default '0',
UNIQUE KEY filename (filename,filepath)
) TYPE=MyISAM;Code: Select all
<?php session_start();
?>
<html>
<head>
<title>Personal Gallery</title>
</head>
<body>
<?php
// database variables for connections
$host = "localhost";
$user = "malcolmboston";
$password = "xxxxxxx";
$DBname = "gallery";
$tablename = "details";
//connection variables completed
// establishing connections
$link = mysql_connect ($host, $user, $password);
//connection established
//the query defined
$query = "SELECT * FROM details";
// select the database
mysql_select_db($DBname);
// query the database
$result = mysql_query($query);
$data = mysql_fetch_array($result, MYSQL_ASSOC);
while ($row = mysql_fetch_assoc($result))
print "
<table width=100% border=0 cellspacing=0 cellpadding=0>
<tr>
<td><img src=$row[thumbnail]></td>
<td><img src=$row[thumbnail]></td>
<td><img src=$row[thumbnail]></td>
<td><img src=$row[thumbnail]></td>
</tr>
<tr>
<td><strong><div align=center>$row[person]</div><strong></td>
<td><strong><div align=center>$row[person]</div><strong></td>
<td><strong><div align=center>$row[person]</div><strong></td>
<td><strong><div align=center>$row[person]</div><strong></td>
</tr>
<tr>
<td>resolution - $row[resolution]</td>
<td>resolution - $row[resolution]</td>
<td>resolution - $row[resolution]</td>
<td>resolution - $row[resolution]</td>
</tr>
<tr>
<td>file size - $row[filesize]kb</td>
<td>file size - $row[filesize]kb</td>
<td>file size - $row[filesize]kb</td>
<td>file size - $row[filesize]kb</td>
</tr>
</table>";
?>
</body>
</html>PICTURE 1 PICTURE 2 ----------> picture 4
name name
resolution resolution
file size file size
PICTURE 5 --------------------------> PICTURE 8 etc
but it all appears the same like this:
PICTURE 1 PICTURE 1 PICTURE PICTURE 1
name etc etc
PICTURE 2 PICTURE 2 PICTURE 2
so basically it is only repeating on the next row, i have tried various HTML setups but cannot get this effect however i know it can be done because google does it (not with PHP but nevertheless)
any ideas guys?