Hi.
I'm familiar with SQL, but I'm new on using PHP to read data from a database and output the result in a html page. I would like to create a dynamic image gallery by using PHP and mySQL.
Let's say I created the table below:
CREATE TABLE GarfieldTable
( CNO char(3) not null primary key,
ComicURL char(19) not null,
ThumbnailURL char(24) not null,
CSIZE char(5),
DISPLAY char(12),
GARFIELD char(3),
JOHN char(3),
ODDIE char(3) );
INSERT
INTO GarfieldTable(CNO, ComicURL, ThumbnailURL, CSIZE, GARFIELD, JOHN, ODDIE)
VALUES ('001','comics/01/Jan01.jpg','comics/01/Jan01thumb.jpg','18 KB','400 x 100','Yes','Yes','No');
INSERT
INTO GarfieldTable(CNO, ComicURL, ThumbnailURL, CSIZE, GARFIELD, JOHN, ODDIE)
VALUES ('002','comics/01/Jan02.jpg','comics/01/Jan02thumb.jpg','16kb','390 x 100','Yes','No','Yes');
INSERT
INTO GarfieldTable(CNO, ComicURL, ThumbnailURL, CSIZE, GARFIELD, JOHN, ODDIE)
VALUES ('003','comics/01/Jan03.jpg','comics/01/Jan03thumb.jpg','17kb','400 x 125','Yes','No','No');
INSERT
INTO GarfieldTable(CNO, ComicURL, ThumbnailURL, CSIZE, GARFIELD, JOHN, ODDIE)
VALUES ('004','comics/01/Jan04.jpg','comics/01/Jan04thumb.jpg','19kb','400 x 400','Yes','Yes','Yes');
If there's anything about the structure of the able that anyone suggest, please tell me. I know the "ComicURL" and "ThumbnailURL" columns could be improved and/or there's another method, but this is the best I can do.
This is how I would like the output to be (this is only half of my problem):
<table width="100%" border="0" cellspacing="8" cellpadding="8">
<tr>
<th width="25%">
<a href="comics/01/Jan01.jpg">
<img src="comics/01/Jan01thumb.jpg" border="2" alt="Jan01" width="40" height="10">
</a>
<br>400 x 100<br>18 KB
</th>
<th width="25%">
<a href="comics/01/Jan02.jpg">
<img src="comics/01/Jan02thumb.jpg" border="2" alt="Jan02" width="39" height="10">
</a>
<br>390 x 100<br>16 KB
</th>
<th width="25%">
<a href="comics/01/Jan03.jpg">
<img src="comics/01/Jan03thumb.jpg" border="2" alt="Jan03" width="40" height="12">
</a>
<br>400 x 125<br>17 KB
</th>
<th width="25%">
<a href="comics/01/Jan04.jpg">
<img src="comics/01/Jan04thumb.jpg" border="2" alt="Jan04" width="40" height="40">
</a>
<br>400 x 400<br>19 KB
</th>
</tr>
</table>
Honestly, I would like this to be dynamic (and customize the selections for the user, which is why I have "Garfield", "John", and "Oddie") using persistent connection since I heard it's faster (unless anyone suggest something else).
Let's say I have 100 records, and I would like to:
A, the most difficult part)
Have it output in the table format above, however, the display will be 12 records max (the table will be 4 columns by 3 rows max) per page/request. How do I have it output something like "Page(s) 1 of 9 for 100 images" and have the user move to the next page when desired. Also, if such a result, would it be possible for a user to jump to, let's say, page 7 that contain records 84-96? I would perfer the option to be a select drop menu, but a list of page(s) (or anything else would) be nice to learn.
B, the easier part)
Have a user customize his/her selection by having a comic that contains any combination of Garfield, John, or Oddie. A drop menu with multi selections (IE: Garfield alone, Garfield AND Oddie, Garfield AND JOHN OR ODDIE).
I would greatly appreciate any help. Thank you.
-Daniel Orellana
DrNeko@excite.com😕