hello and please excuse me again for my clumsy english.
As I wrote few weeks ago, I'm not programer, but I have to create one
script. that is a gallery script, and after successful work on flatfile
gallery script I'w decided to build mysql script.
frontend is almost done, everything is working fine, except ending of
tables..
I will try to describe and draw what I mean:
if I have 8 pics to be shown, and if choose to have 4 columns in row,
table will close fine:
<table>
<tr><td>IMG</td><td>IMG</td><td>IMG</td><td>IMG</td></tr>
<tr><td>IMG</td><td>IMG</td><td>IMG</td><td>IMG</td></tr>
</table>
but, if I have 9 pics, i will have "hole" in my table:
<table>
<tr><td>IMG</td><td>IMG</td><td>IMG</td><td>IMG</td></tr>
<tr><td>IMG</td><td>IMG</td><td>IMG</td><td>IMG</td></tr>
<tr><td>IMG</td></tr>
</table>
now... how to draw those missing <td> </td>?
or to create <td colspan=\"$somenumber\"> ?
how to calculate that $somenumber ?
(that solution with colspan is easier, but I would like to learn both
solutions)
here is one part of my code:
(I believe that it can be written much nicer, but again, I'm just
starting with your language... php I mean.)
function collect_authors() {
global $incl, $incp, $tbrd, $PHP_SELF, $i;
print "<table border=\"$tbrd\" cellspacing=\"0\"
cellpadding=\"$incp\"><tr>\n";
// subfunction get AUTOR
$query1 = "SELECT AutorID,AutorName,AutorPrez,AutorPict FROM
autor";
$result1 = mysql_query ($query1) or die ("shit, f*query failed
($query1)");
while (list($AutorID,$AutorName,$AutorPrez,$AutorPict) =
mysql_fetch_array($result1)) {
// takeing picture size and calculating squized
thumbnail
list($width, $height, $type, $attr) =
getimagesize("faces/$AutorPict");
$smal = $width / 50;
$heih = floor($height / $smal + 0.5);
print "<td align=\"right\" valign=\"top\">\n\n".
"<table width=\"100%\" border=\"0\"
cellspacing=\"2\" cellpadding=\"0\">\n<tr>\n<td colspan=\"2\"
align=\"left\" valign=\"bottom\">\n".
"<a class=\"autor\"
href=\"$PHP_SELF?AutorID=$AutorID\"><br>$AutorName
$AutorPrez</a>\n</td>\n</tr>\n".
"<tr>\n<td align=\"right\" valign=\"top\">\n".
"<p>\n<img class=\"pict\" src=\"faces/$AutorPict\"
alt=\"$AutorName\" width=\"50\" height=\"$heih\">\n</p>\n".
"</td>\n<td align=\"left\" valign=\"top\">\n";
// subfunction get ALBUM
$query2 = "SELECT AlbumID,AlbumName FROM album WHERE
AutorID=$AutorID";
$result2 = mysql_query ($query2) or die ("shit, f*query
failed ($query2)");
while (list($AlbumID,$AlbumName) =
mysql_fetch_array($result2)) {
print "<p>\n<a class=\"album\"
href=\"$PHP_SELF?AlbumID=$AlbumID\">$AlbumName</a>\n</p>\n";
}
print "</td>\n</tr>\n</table>\n\n</td>\n";
$i++;
if ($i % $incl == 0) {
print "</tr>\n<tr>\n";
}
}
print
"</table>\n\n";
}
tnx for any help.
--
Jan_ko?
--