Volgende vorige pagina script geeft alles aan
Ik heb een vorige volgende pagina script toegevoed aan mijn site.. alleen nu krijg ik alles uit de DB te zien en niet alleen de eerste 3.
Ziet iemand wat ik verkeerd doe?
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<?php
include('top.php');
require_once("includes/verbinding.php");
$page = (!isset($_GET['page'])) ? 1 : $_GET['page'];
//aantal records per pagina
$max = 3;
$start = ($max * $page) - $max;
//hier je gegevens van je mysql ophalen
$sql = "SELECT * FROM auto ORDER BY id, merk DESC";
$res = mysql_query($sql);
if (mysql_num_rows($res) >= 1)
{
?>
<table width="526" align="center" class="bigborder">
<tr>
<td class="occasion1" align="left" width="125"><B>Foto</B></td>
<td class="occasion1" align="left" width="148"><B>Auto</B></td>
<td class="occasion2" width="64" ><B>Bouwjaar</B></td>
<td class="occasion2" width="66" ><B>Prijs</B></td>
<td class="occasion2" width="140" ><B>Details</B></td>
</tr>
<tr>
<td colspan="5" class="occasion1"> </td>
</tr>
</table>
<?php
while ($row = mysql_fetch_array($res))
{
?>
<table class="bigborder" align="center">
<tr>
<td class="occasion1" width="125" align="left"><a href="<?php echo "details.php?id=$row[id]"; ?>"><img src="<?php echo "fotoauto/$row[afbeelding_1]" ?>" width="99" height="75" style="border-style: none"></a></td>
<td class="occasion2" width="148"><?php echo "<span class =\"occasion1\"> $row[merk]"; ?> <?php echo "<span class =\"occasion1\"> $row[model]"; ?> <?php echo "<span class =\"occasion1\"> $row[type]"; ?></td>
<td class="occasion2" width="64" ><?php echo "<span class =\"occasion1\"> $row[bouwjaar]"; ?></td>
<td class="occasion2" width="66" ><?php echo "<span class =\"occasion1\"> $row[prijs]"; ?></td>
<td class="occasion2" width="140" ><a href="<?php echo "details.php?id=$row[id]"; ?>">Details</a></td>
</tr>
</table>
<br>
<?php
}
} else {
echo "Momenteel staan er geen auto's in onze database, excuses.";
}
//hier aan jou mysql gegevens aanpassen
$rows = mysql_result(mysql_query("SELECT COUNT(id) FROM auto ORDER BY id"),0);
$pages = ceil($rows / $max);
if ($page > 1) {
$previous = $page - 1;
echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?page=" . $previous . "\"><<</a> ";
}
for ($i = 1; $i <= $pages; $i++) {
if ($page == $i) {
if ($i == $pages) {
echo "<b>" . $i . "</b> ";
} else {
echo "<b>" . $i . "</b>, ";
}
} else {
if ($i == $pages) {
echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?page=" . $i . "\">" . $i . "</a> ";
} else {
echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?page=" . $i . "\">" . $i . "</a>, ";
}
}
}
if ($page < $pages) {
$next = $page + 1;
echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?page=" . $next . "\">>></a>";
}
include('bottom.php');
?>
include('top.php');
require_once("includes/verbinding.php");
$page = (!isset($_GET['page'])) ? 1 : $_GET['page'];
//aantal records per pagina
$max = 3;
$start = ($max * $page) - $max;
//hier je gegevens van je mysql ophalen
$sql = "SELECT * FROM auto ORDER BY id, merk DESC";
$res = mysql_query($sql);
if (mysql_num_rows($res) >= 1)
{
?>
<table width="526" align="center" class="bigborder">
<tr>
<td class="occasion1" align="left" width="125"><B>Foto</B></td>
<td class="occasion1" align="left" width="148"><B>Auto</B></td>
<td class="occasion2" width="64" ><B>Bouwjaar</B></td>
<td class="occasion2" width="66" ><B>Prijs</B></td>
<td class="occasion2" width="140" ><B>Details</B></td>
</tr>
<tr>
<td colspan="5" class="occasion1"> </td>
</tr>
</table>
<?php
while ($row = mysql_fetch_array($res))
{
?>
<table class="bigborder" align="center">
<tr>
<td class="occasion1" width="125" align="left"><a href="<?php echo "details.php?id=$row[id]"; ?>"><img src="<?php echo "fotoauto/$row[afbeelding_1]" ?>" width="99" height="75" style="border-style: none"></a></td>
<td class="occasion2" width="148"><?php echo "<span class =\"occasion1\"> $row[merk]"; ?> <?php echo "<span class =\"occasion1\"> $row[model]"; ?> <?php echo "<span class =\"occasion1\"> $row[type]"; ?></td>
<td class="occasion2" width="64" ><?php echo "<span class =\"occasion1\"> $row[bouwjaar]"; ?></td>
<td class="occasion2" width="66" ><?php echo "<span class =\"occasion1\"> $row[prijs]"; ?></td>
<td class="occasion2" width="140" ><a href="<?php echo "details.php?id=$row[id]"; ?>">Details</a></td>
</tr>
</table>
<br>
<?php
}
} else {
echo "Momenteel staan er geen auto's in onze database, excuses.";
}
//hier aan jou mysql gegevens aanpassen
$rows = mysql_result(mysql_query("SELECT COUNT(id) FROM auto ORDER BY id"),0);
$pages = ceil($rows / $max);
if ($page > 1) {
$previous = $page - 1;
echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?page=" . $previous . "\"><<</a> ";
}
for ($i = 1; $i <= $pages; $i++) {
if ($page == $i) {
if ($i == $pages) {
echo "<b>" . $i . "</b> ";
} else {
echo "<b>" . $i . "</b>, ";
}
} else {
if ($i == $pages) {
echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?page=" . $i . "\">" . $i . "</a> ";
} else {
echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?page=" . $i . "\">" . $i . "</a>, ";
}
}
}
if ($page < $pages) {
$next = $page + 1;
echo "<a href=\"" . $_SERVER['PHP_SELF'] . "?page=" . $next . "\">>></a>";
}
include('bottom.php');
?>
Quote:
ModEdit: tags toegevoegd
Gewijzigd op 01/01/1970 01:00:00 door Peter
select .... LIMIT 0,2