PHP beginner |
|
<?php
session_start();
ob_start();
?>
<? error_reporting(E_ALL); ?>
<table width="90%" align="center">
<tr>
<td>
<?php
require 'functions.php'; //database connectie
db_open();
#### Begin Navigatie code ####
$max=4;
if ($_GET['pagina']=="")
{
$_GET['pagina']=1;
}
if(!isset($_GET['id']))
{
$sql = "SELECT * FROM products ORDER BY ID DESC";
$query = mysql_query($sql) or die(mysql_error());
$rtel = mysql_num_rows($query);
$rtel2=$rtel/$max;
for($i=1; $i < $rtel2+1; $i++)
{
if($i==$_GET['pagina'])
{
$paginas[$i]="<b>".$i."</b>";
} else
{
$paginas[$i]="<a href=\"".$_SERVER[PHP_SELF]."?page=web_winkel&pagina=$i\">".$i."</a>";
}
}
$a=count($paginas);
$paginas=implode(" | ",$paginas);
if($_GET['pagina'] > 1)
{
$p=$_GET['pagina']-1;
$vorige="<a href='".$_SERVER[PHP_SELF]."?page=web_winkel&pagina=".$p."'><Vorige </a>";
}
if($_GET['pagina'] != $a)
{
$p=$_GET['pagina']+1;
$volgende="<a href='".$_SERVER[PHP_SELF]."?page=web_winkel&pagina=".$p."'>Volgende></a>";
}
$navigatie = (" $vorige $paginas $volgende");
if ($rtel < 1)
{
echo "<div align=center>Er zijn momenteel geen nieuwsberichten!</font></div>";
} else
{
$begin=$max*$_GET['pagina']-5;
$eind=$max*$_GET['pagina'];
$sql = 'select * from products order by sTitel DESC LIMIT '. $begin .','. $eind;
$query = mysql_query($sql);
if($query===false)
echo 'hier gaat het fout: '.$sql .'<br>doet '. mysql_error();
$list=array();
while (list($id, $sTitel,)=mysql_fetch_row($query)) { //begin while lus
?>
<br>
<table width="730" class="tekst">
<tr>
<td rowspan="4" width="230" >
<?
$result = mysql_query("SELECT sFoto_groot,sBeschrijving, sOverzichtnummers, fPrice FROM `products` WHERE id = ".$id);
while ($arr = mysql_fetch_assoc($result))
{ //begin while lus
echo '<img src="'.$arr['sFoto_groot'].'" alt="">';
?>
</td>
<td style="vertical-align: top;" ><strong>Titel: </strong></td>
<td> <?=$sTitel; ?> </td>
</tr>
<tr>
<td style="width: 100px;">
<strong>Beschrijving: </strong>
</td>
<td>
<?php
echo ''.$arr['sBeschrijving'];
?>
</td>
</tr>
<tr>
<td style="width: 150px;">
<strong>Overzicht nummers:</strong>
</td>
<td >
<a href="<?=$arr['sOverzichtnummers']; ?>" onclick="window.open('<?=$arr['sOverzichtnummers']; ?>','CorvanDijk',
'width=450,height=380,scrollbars=no,toolbar=yes,location=no'); return false" onMouseOver = "this.className = 'menu_items_h';status = 'Overzicht nummers'; return true" onMouseOut = "this.className = 'menu_items';status = ''; return true">[Overzicht nummers]</a>
</td>
</tr>
<tr>
<td style="width: 100px;">
<strong>Prijs: </strong>
</td>
<td>
€ <?=$arr['fPrice']; ?>
</td>
</tr>
<tr>
<td style="width: 100px;">
</td>
<td colspan="3" align="left"">
<form action="add.php" method=post><input type=hidden name=id value="<?=$id; ?>"><input type=image src="afbeeldingen/winkelmandje.jpg" title="Stop prodcuts in winkelmandje"> <input name=aantal size="1" value="1"></form>
</td>
</tr>
</table>
<?
}
}
}
}
?>
<table>
<tr>
<td>
<?php echo"$navigatie"; ?>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
db_close();
?>
|