Hi,
I am fairly new to PHP, but picking up some ideas fairly quickly. I have a site that is completely PHP driven and works real well, but now I need some help optimizing one area.
In one section, I am search for results and putting thumbnails into table. I want to have four thumbnails per table row. Below is how I did it, very ugly. Kinda works. Is there a better way?
You can see the page in work at:
http://baby.brynteson.info/pics.php
Thanks and if you need more source code, I'll send the entire file.
Thanks again,
Richard
$result = mysql_query("SELECT FROM pics where pictype = '$pictype' order by id LIMIT 0, 4",$db);
$result2 = mysql_query("SELECT FROM pics where pictype = '$pictype' order by id LIMIT 4, 4",$db);
$result3 = mysql_query("SELECT * FROM pics where pictype = '$pictype' order by id LIMIT 8, 4",$db);
printf("<div style='POSITION: absolute; TOP: 125px; LEFT: 75px; Z-INDEX: 25; WIDTH: 500px'>\n");
printf("<TABLE border='1' cellspacing='2' cellpadding='2'>
<TR>
<TD colspan='9' bgcolor='#d62261'>
<FONT COLOR='#ffffff' SIZE='-1' FACE='Verdana'>Pictures</font>
</TD>
</TR>
<tr>
\n");
while ($myrow = mysql_fetch_array($result)) {
printf("
<td BGCOLOR='#ffffff'>
<center>
<a href=\"pics.php?id=%s\"><img src='images/%s'><br>
%s
</center>
</a>
</td>
\n", $myrow["id"], $myrow["thumbname"], $myrow["short"]);
}
printf("</tr><tr>\n");
while ($myrow2 = mysql_fetch_array($result2)) {
printf("
<td BGCOLOR='#ffffff'>
<center>
<a href=\"pics.php?id=%s\"><img src='images/%s'><br>
%s
</center>
</a>
</td>
\n", $myrow2["id"], $myrow2["thumbname"], $myrow2["short"]);
}
printf("</tr><tr>\n");
while ($myrow3 = mysql_fetch_array($result3)) {
printf("
<td BGCOLOR='#ffffff'>
<center>
<a href=\"pics.php?id=%s\"><img src='images/%s'><br>
%s
</center>
</a>
</td>
\n", $myrow3["id"], $myrow3["thumbname"], $myrow3["short"]);
}