Forums

PHP

This topic is locked

Create Photo Album

Posted 07 Aug 2002 08:41:58
1
has voted
07 Aug 2002 08:41:58 Johnny Lee posted:
Hi,

I try to create a photo album using php and MySQL. The names of the photos are already in the database. My question is how can I display the photos in 5 columns and 5 rows on each page? If I use repeat region for the first photo, then it would either display 25 photos in one row or in 25 rows. What tags do I need to put in so it would know to go to a new row at the fifth column?
Thank you.

Johnny

Replies

Replied 07 Aug 2002 15:10:03
07 Aug 2002 15:10:03 Aurel Sorin Cirstoiu replied:
Use a table with 5 columns and 5 rows.

-----------------------
Cirstoiu Aurel Sorin
InterAKT Support
www.interakt.ro
-----------------------
Replied 07 Aug 2002 19:19:19
07 Aug 2002 19:19:19 Peter R replied:
You need the extension Horizontal Looper 2 from basic-ultradev.com

This will allow the repeat region to go across the page as well as down. You can tell it how many columns and rows you want to display on a page.

Peter
Replied 08 Aug 2002 00:49:34
08 Aug 2002 00:49:34 Johnny Lee replied:
Hi partypete,

This is exactly what I am looking for. Unfortunately I am using Dreamweaver MX and this extension doesn't work in Dreamweaver MX.

I am wondering if you could create a simple example and send the code to me. That way I would be able to figure out how to do it.

Thank you very much. Johnny
Replied 09 Aug 2002 09:41:18
09 Aug 2002 09:41:18 Tim Green replied:
Please remember that the Horizontal Looper code is COPYWRITTEN. This means that you can't just get someone else to create the code for you and then have them send it to you. This counts as ILLEGAL distribution of the code.

Always ensure that you get the Author's permission before you do something like this, as UDZone cannot and WILL NOT condone the distribution of code like this.

Tim Green

Extension & PHP TalkZone Manager
<font size=1>-------------------------------------------
<i>Please read the Forum FAQ before posting
a question to this TalkZone.</i>
-------------------------------------------
www.UDzone.com : A dynamic Dreamweaver,
Ultradev and Fireworks site for developers
by developers.
-------------------------------------------</font id=size1>
Replied 12 Aug 2002 15:38:34
12 Aug 2002 15:38:34 Michael Guntenaar replied:
This is actually very simple, only you need to escape Dreamwaver for it <img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>

<pre id=code><font face=courier size=2 id=code>
&lt;?php
#your query

$picture_query = mysql_query("Your query";

#count how much records (in your case pictures) it found

$count_rows = mysql_num_rows($picture_query);

#opening table row

echo("&lt;tr&gt;";

#set your count start for the first record

$i = 1;


#start looping trough the records every time make an &lt;td&gt;.

while ($showpic = mysql_fetch_array($picture_query)) {

echo("&lt;td align=\"left\" &gt;&lt;img src=\"{$showpic[ 'path' ]}\" border=\"1\"&gt;&lt;/a&gt;";

#until you reach 5 then make en new row "&lt;tr&gt;"

if ($i%5 == 0) echo("&lt;/tr&gt;&lt;tr&gt;";

#+1 for your count every time it loops

$i++;
}

?&gt;</font id=code></pre id=code>

Have a ball <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>


Edited by - mguntenaar on 12 Aug 2002 15:42:00

Edited by - mguntenaar on 12 Aug 2002 15:42:52

Reply to this topic