Código PHP:
<?php
for ($i = $startrec; $i < $reccount; $i++)
{
$row = mysql_fetch_assoc($res);
$style = "dr";
if ($i % 2 != 0) {
$style = "sr";
}
?>
<tr>
<td class="<?php echo $style ?>"><?php echo build_link("http://localhost/imagen/imagen/", htmlspecialchars($row["id"]), ".php", "", outimage($i, "ima", "20", "", "")) ?></td>
</tr>
<?php
}
mysql_free_result($res);
?>
Código PHP:
function outimage($recid, $field, $alt, $width, $height)
{
$res = "<img src=\"ima.php?getimage=$recid&field=$field\" border=0 alt=\"$alt\"";
if ($width <> '')
$res = $res." width=\"$width\"";
if ($height <> '')
$res = $res." height=\"$height\"";
$res = $res.">";
return $res;
}
function getimage($recid, $field)
{
$res = sql_select();
mysql_data_seek($res, $recid);;
$row = mysql_fetch_assoc($res);
echo $row[$field];
}
function build_link($prefix, $href, $suffix, $target, $content)
{
if ($href == '')
{
$res = $content;
}
else
{
$res = "<a href=\"".$prefix.$href.$suffix."\" target=\"".$target."\">".$content."</a>";
}
return $res;
}