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=\"$some number\"> ?
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,AutorNa me,AutorPrez,Au torPict FROM
autor";
$result1 = mysql_query ($query1) or die ("shit, f*query failed
($query1)");
while (list($AutorID, $AutorName,$Aut orPrez,$AutorPi ct) =
mysql_fetch_arr ay($result1)) {
// takeing picture size and calculating squized
thumbnail
list($width, $height, $type, $attr) =
getimagesize("f aces/$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_SEL F?AutorID=$Auto rID\"><br>$Auto rName
$AutorPrez</a>\n</td>\n</tr>\n".
"<tr>\n<td align=\"right\" valign=\"top\"> \n".
"<p>\n<img class=\"pict\" src=\"faces/$AutorPict\"
alt=\"$AutorNam e\" width=\"50\" height=\"$heih\ ">\n</p>\n".
"</td>\n<td align=\"left\" valign=\"top\"> \n";
// subfunction get ALBUM
$query2 = "SELECT AlbumID,AlbumNa me FROM album WHERE
AutorID=$AutorI D";
$result2 = mysql_query ($query2) or die ("shit, f*query
failed ($query2)");
while (list($AlbumID, $AlbumName) =
mysql_fetch_arr ay($result2)) {
print "<p>\n<a class=\"album\"
href=\"$PHP_SEL F?AlbumID=$Albu mID\">$AlbumNam e</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?
--
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=\"$some number\"> ?
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,AutorNa me,AutorPrez,Au torPict FROM
autor";
$result1 = mysql_query ($query1) or die ("shit, f*query failed
($query1)");
while (list($AutorID, $AutorName,$Aut orPrez,$AutorPi ct) =
mysql_fetch_arr ay($result1)) {
// takeing picture size and calculating squized
thumbnail
list($width, $height, $type, $attr) =
getimagesize("f aces/$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_SEL F?AutorID=$Auto rID\"><br>$Auto rName
$AutorPrez</a>\n</td>\n</tr>\n".
"<tr>\n<td align=\"right\" valign=\"top\"> \n".
"<p>\n<img class=\"pict\" src=\"faces/$AutorPict\"
alt=\"$AutorNam e\" width=\"50\" height=\"$heih\ ">\n</p>\n".
"</td>\n<td align=\"left\" valign=\"top\"> \n";
// subfunction get ALBUM
$query2 = "SELECT AlbumID,AlbumNa me FROM album WHERE
AutorID=$AutorI D";
$result2 = mysql_query ($query2) or die ("shit, f*query
failed ($query2)");
while (list($AlbumID, $AlbumName) =
mysql_fetch_arr ay($result2)) {
print "<p>\n<a class=\"album\"
href=\"$PHP_SEL F?AlbumID=$Albu mID\">$AlbumNam e</a>\n</p>\n";
}
print "</td>\n</tr>\n</table>\n\n</td>\n";
$i++;
if ($i % $incl == 0) {
print "</tr>\n<tr>\n";
}
}
"</table>\n\n";
}
tnx for any help.
--
Jan_ko?
--
Comment