Hello. I'm having problem with paginating images. The problem is, that I have written my 50 images in DB field (all in 1 field) in this form:
<a href="#" onclick="window.open('sta70511.html', 'Bilde', 'toolbar=no, status=no, scrollbars=no, menubar=no, width=768, height=576')"><img src="images-small/sta70511_small.jpg" border="0"></a>
That would be 1 image, but I have another 49 there. Now I'm trying to display them, but something's not working. Take a look at the code:
<?
$konekcija=mysql_connect('127.0.0.1','*','*') or die ("Error");
mysql_select_db('*',$konekcija);
$vaicajums2="select * from `section2` where `section`= 'photo2006'";
$result=mysql_query($vaicajums2,$konekcija);
while ( $rs = mysql_fetch_array ($result) ) {
$field = $rs['text'];
$images = substr_count ($field, '</a>');
echo "I have $images images here<br />\n";
$test=explode("</a>", $rs['teksts']);
}
mysql_close($konekcija);
@$lpp=$_GET['lpp'];
if (empty($lpp)){
$lpp=1;}
$lappuses=$images/10;
$lappuses=ceil($lappuses);
if($i>=($lpp*10-10)AND $i<($lpp*10)){
echo $tests;
}
echo "<hr size=2 color=#7D0415>";
echo "<center>";
if($lpp > 1)
{
$tmp = $lpp - 1;
echo "<a href = '?lpp=$tmp'><< Back</a> ";
}
for($j=1;$j<=$lappuses;$j++){
if($j == $lpp){
echo "<b><font color=\"black\" face=\"verdana\" size=\"2\"><a href=\"?lpp=$j\">$j</a></font></b> ";
} else {
echo "<a href=\"?lpp=$j\">$j</a> ";
}
}
if($lpp < $lappuses)
{
$tmp = $lpp+1;
echo " <a href = '?lpp=$tmp'>Forward >></a>";
}
echo "</center>";
?>