Simpel mp3 scriptje,
maar als ik laat zoals het nu is blijft mijn script ALLES weergeven en dat is niet handig. Ik wil dat hij maximaal 5 dingen weergeeft en dat ik kan drukken van volgende 5 en dat hij dat id 4-9 laat zien bijvoorbeeld snap je?
hier is m'n huidig script!
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
<?php
include "include/config.php";
$connection = mysql_connect ("$host","$gebruiker","$wachtwoord")
or die ("kan geen verbinding maken met de database");
$db = mysql_select_db("$database")
or die("kan geen verbinding maken");
$select = ("SELECT * FROM mp3 WHERE ID=4"); // Selecteren uit een tabel
$query = mysql_query($select);
$aantal = mysql_num_rows($query);
while($list = mysql_fetch_object($query)){
$a++;
?>
include "include/config.php";
$connection = mysql_connect ("$host","$gebruiker","$wachtwoord")
or die ("kan geen verbinding maken met de database");
$db = mysql_select_db("$database")
or die("kan geen verbinding maken");
$select = ("SELECT * FROM mp3 WHERE ID=4"); // Selecteren uit een tabel
$query = mysql_query($select);
$aantal = mysql_num_rows($query);
while($list = mysql_fetch_object($query)){
$a++;
?>
<a href= target="mp3"></a><br>
<iframe height="16" name="mp3" src="">
zoek eens op LIMIT
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
2
3
4
5
6
7
8
9
10
11
12
<?php
include "include/config.php";
$connection = mysql_connect ("$host","$gebruiker","$wachtwoord")
or die ("kan geen verbinding maken met de database");
$db = mysql_select_db("$database")
or die("kan geen verbinding maken");
$start = 0;
$select = ("SELECT * FROM mp3 LIMIT $_GET[view] OFFSET $_GET[start]"); // Selecteren uit een tabel
$query = mysql_query($select);
$aantal = mysql_num_rows($query);
while($list = mysql_fetch_object($query)){
?>
include "include/config.php";
$connection = mysql_connect ("$host","$gebruiker","$wachtwoord")
or die ("kan geen verbinding maken met de database");
$db = mysql_select_db("$database")
or die("kan geen verbinding maken");
$start = 0;
$select = ("SELECT * FROM mp3 LIMIT $_GET[view] OFFSET $_GET[start]"); // Selecteren uit een tabel
$query = mysql_query($select);
$aantal = mysql_num_rows($query);
while($list = mysql_fetch_object($query)){
?>
<a href= target="mp3"></a><br>
<iframe height="16" width="200" name="mp3" src="">
ID, url, name
op die volgorde, en dan iframe je hem gewoon op de site waar jehem wilt (myspace, netvibes, igoogle)
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/************************************************************************/
/* Previous/Next Script */
/* ==================== */
/* */
/* Copyright (c) 2004 by Elwin [a.k.a. SpaceFrog] */
/* http://spacefrog.ath.cx */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/* */
/* Version: 1.2 */
/* Changes: Changed the presentation of the pagenumbers (version 1.1), */
/* added a bold pagenumber for the page where the user is on. (by */
/* Elwin) */
/* */
/* Version History */
/* Version 1.1: Added pagenumbers which include a hyperlink to the page */
/* (by Elwin) */
/* Version 1.0: Default script wich includes the Previous / Next hyper- */
/* links (by Elwin) */
/************************************************************************/
include "include/config.php";
// Connect to the Databaseserver
mysql_connect ("$host","$gebruiker","$wachtwoord");
// Select the Database
mysql_select_db("$database");
// Variables
if(is_numeric($_GET['max'])) $max = $_GET['max'];
if(is_numeric($_GET['start'])) $start = $_GET['start'];
if (empty($max)) $max = 5; // $max is the maximum number of results per page
if (empty($start)) $start = 0; // This is the number to start the query at the right location [DO NOT EDIT]
// Calculate some stuff
$end = $start + $max; // This is for the query, gives the number for the LIMIT
$prev = $start - $max; // This number is for $start in the Previous-hyperlink
$next = $end; // This number is for $start in the Next-hyperlink
// Select everything from the table
$query = mysql_query("SELECT * FROM mp3 ORDER BY name ASC LIMIT $start, $max") or die (mysql_error());
// Number of rows from $query
$num = mysql_num_rows($query);
if (empty($num))
{
echo "<p>Geen mp3's in database</p>";
}
else
{
while ($result = mysql_fetch_row($query))
{
// Show the results
echo "<a href=\"$result[1]\" target='mp3'>$result[2]</a><br>";
}
echo "<p>\n";
// Check if $prev is higher than or equal to 0, if so add the Previous-hyperlink
if ($prev >= '0')
{
echo "[<a href=\"http://jeffro.no-ip.info/test.php?start=$prev&max=$max\">Previous</a>]\n";
} else {
echo "[Previous]\n";
}
// Count how many rows there are in the table
$count = mysql_fetch_row(mysql_query("SELECT count(*) FROM mp3"));
// Calculate on which page we are
$thispage = ceil($start/$max+1);
// If $count[0] is higher than $max, show the pagenumbers
if ($count[0] > $max)
{
// Calculate the amount of pages
$total = ceil($count[0]/$max);
for($i=0;$i<$total;$i++)
{
// The number to show has to be $1+1 (because $i starts with 0)
$number = $i+1;
// $start has to be $i * $max
$start = $i*$max;
// If thispage is equal to the number, the link has to be bold
if ($thispage == $number)
{
echo "<strong>[<a href=\"http://jeffro.no-ip.info/test.php?start=" . $start . "&max=" . $max . "\">" . $number . "</a>]</strong>\n";
} else {
echo "<a href=\"http://jeffro.no-ip.info/test.php?start=" . $start . "&max=" . $max . "\">" . $number . "</a>\n";
}
}
}
// If $count[0] is higher than $next, show the hyperlink
if ($count[0] > $next)
{
echo "[<a href=\"http://jeffro.no-ip.info/test.php?start=$next&max=$max\">Next</a>]\n";
} else {
echo "[Next]\n";
}
echo "</p>\n";
}
?>
/************************************************************************/
/* Previous/Next Script */
/* ==================== */
/* */
/* Copyright (c) 2004 by Elwin [a.k.a. SpaceFrog] */
/* http://spacefrog.ath.cx */
/* */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License. */
/* */
/* Version: 1.2 */
/* Changes: Changed the presentation of the pagenumbers (version 1.1), */
/* added a bold pagenumber for the page where the user is on. (by */
/* Elwin) */
/* */
/* Version History */
/* Version 1.1: Added pagenumbers which include a hyperlink to the page */
/* (by Elwin) */
/* Version 1.0: Default script wich includes the Previous / Next hyper- */
/* links (by Elwin) */
/************************************************************************/
include "include/config.php";
// Connect to the Databaseserver
mysql_connect ("$host","$gebruiker","$wachtwoord");
// Select the Database
mysql_select_db("$database");
// Variables
if(is_numeric($_GET['max'])) $max = $_GET['max'];
if(is_numeric($_GET['start'])) $start = $_GET['start'];
if (empty($max)) $max = 5; // $max is the maximum number of results per page
if (empty($start)) $start = 0; // This is the number to start the query at the right location [DO NOT EDIT]
// Calculate some stuff
$end = $start + $max; // This is for the query, gives the number for the LIMIT
$prev = $start - $max; // This number is for $start in the Previous-hyperlink
$next = $end; // This number is for $start in the Next-hyperlink
// Select everything from the table
$query = mysql_query("SELECT * FROM mp3 ORDER BY name ASC LIMIT $start, $max") or die (mysql_error());
// Number of rows from $query
$num = mysql_num_rows($query);
if (empty($num))
{
echo "<p>Geen mp3's in database</p>";
}
else
{
while ($result = mysql_fetch_row($query))
{
// Show the results
echo "<a href=\"$result[1]\" target='mp3'>$result[2]</a><br>";
}
echo "<p>\n";
// Check if $prev is higher than or equal to 0, if so add the Previous-hyperlink
if ($prev >= '0')
{
echo "[<a href=\"http://jeffro.no-ip.info/test.php?start=$prev&max=$max\">Previous</a>]\n";
} else {
echo "[Previous]\n";
}
// Count how many rows there are in the table
$count = mysql_fetch_row(mysql_query("SELECT count(*) FROM mp3"));
// Calculate on which page we are
$thispage = ceil($start/$max+1);
// If $count[0] is higher than $max, show the pagenumbers
if ($count[0] > $max)
{
// Calculate the amount of pages
$total = ceil($count[0]/$max);
for($i=0;$i<$total;$i++)
{
// The number to show has to be $1+1 (because $i starts with 0)
$number = $i+1;
// $start has to be $i * $max
$start = $i*$max;
// If thispage is equal to the number, the link has to be bold
if ($thispage == $number)
{
echo "<strong>[<a href=\"http://jeffro.no-ip.info/test.php?start=" . $start . "&max=" . $max . "\">" . $number . "</a>]</strong>\n";
} else {
echo "<a href=\"http://jeffro.no-ip.info/test.php?start=" . $start . "&max=" . $max . "\">" . $number . "</a>\n";
}
}
}
// If $count[0] is higher than $next, show the hyperlink
if ($count[0] > $next)
{
echo "[<a href=\"http://jeffro.no-ip.info/test.php?start=$next&max=$max\">Next</a>]\n";
} else {
echo "[Next]\n";
}
echo "</p>\n";
}
?>
<iframe height='16' width='200' name='mp3' src=''>