Parse error
Regel 95 is de laatste regel van het script!!
Iemand enig idee???? (Apache/1.3.20, PHP v4.1.2, MySQL v3.23.39, Unix). Url=http://henkegberts.nl/search.htm = zoekformulier.
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
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
<?
$server = "localhost";
$user = "user";
$pass = "pass";
$databasename = "dbname";
$db = mysql_connect($server, $user, $pass);
mysql_select_db($databasename,$db);
$sql = "SELECT * FROM MP3sTabelle";
$query = mysql_query($sql,$db);
$total_results = mysql_num_rows($query);
$limit = "25"; //limit of archived results per page.
$total_pages = ceil($total_results / $limit); //total number of pages
if (empty($page))
{
$page = "1"; //default page if none is selected
}
$offset = ($page - 1) * $limit; //starting number for displaying results out of DB
$var = @$_GET['q'] ;
$trimmed = trim($var); //trim whitespace from the stored variable
$query = "SELECT Artist, Album, Trackno, Songname, GenreReal FROM MP3sTabelle WHERE Arist LIKE \"$trimmed\" ORDER BY Album LIMIT $offset, $limit";
$result = mysql_query($query);
if (!$result) { die($query."<br />".mysql_error()); }
//This is the start of the normal results...
while ($row = mysql_fetch_array($result))
{
print "{$row['Artist']}{$row['Album']}{$row['Trackno']}{$row['Songname']}{$row['GenreReal']}<br>";
{
// Release the Result Set
mysql_free_result($result);
// Close the connection
mysql_close($db);
// This is the Previous/Next Navigation
echo "<font face=Verdana size=1>";
echo "Pages:($total_pages) "; // total pages
if ($page != 1)
{
echo "<a href=$PHP_SELF?page=1><< First</a> "; // First Page Link
$prevpage = $page - 1;
echo " <a href=$PHP_SELF?page=$prevpage><<</a> "; // Previous Page Link
}
if ($page == $total_pages)
{
$to = $total_pages;
}
elseif ($page == $total_pages-1)
{
$to = $page+1;
}
elseif ($page == $total_pages-2)
{
$to = $page+2;
}
else
{
$to = $page+3;
}
if ($page == 1 || $page == 2 || $page == 3)
{
$from = 1;
}
else
{
$from = $page-3;
}
for ($i = $from; $i <= $to; $i++)
{
if ($i == $total_results) $to=$total_results;
if ($i != $page)
{
echo "<a href=$PHP_SELF?showold=yes&page=$i>$i</a>";
}
else
{
echo "<b><font face=Verdana size=2>[$i]</font></b>";
}
if ($i != $total_pages)
echo " ";
}
if ($page != $total_pages)
{
$nextpage = $page + 1;
echo " <a href=$PHP_SELF?page=$nextpage>>></a> "; // Next Page Link
echo " <a href=$PHP_SELF?page=$total_pages>Last >></a>"; // Last Page Link
echo "</font>";
}
?>
$server = "localhost";
$user = "user";
$pass = "pass";
$databasename = "dbname";
$db = mysql_connect($server, $user, $pass);
mysql_select_db($databasename,$db);
$sql = "SELECT * FROM MP3sTabelle";
$query = mysql_query($sql,$db);
$total_results = mysql_num_rows($query);
$limit = "25"; //limit of archived results per page.
$total_pages = ceil($total_results / $limit); //total number of pages
if (empty($page))
{
$page = "1"; //default page if none is selected
}
$offset = ($page - 1) * $limit; //starting number for displaying results out of DB
$var = @$_GET['q'] ;
$trimmed = trim($var); //trim whitespace from the stored variable
$query = "SELECT Artist, Album, Trackno, Songname, GenreReal FROM MP3sTabelle WHERE Arist LIKE \"$trimmed\" ORDER BY Album LIMIT $offset, $limit";
$result = mysql_query($query);
if (!$result) { die($query."<br />".mysql_error()); }
//This is the start of the normal results...
while ($row = mysql_fetch_array($result))
{
print "{$row['Artist']}{$row['Album']}{$row['Trackno']}{$row['Songname']}{$row['GenreReal']}<br>";
{
// Release the Result Set
mysql_free_result($result);
// Close the connection
mysql_close($db);
// This is the Previous/Next Navigation
echo "<font face=Verdana size=1>";
echo "Pages:($total_pages) "; // total pages
if ($page != 1)
{
echo "<a href=$PHP_SELF?page=1><< First</a> "; // First Page Link
$prevpage = $page - 1;
echo " <a href=$PHP_SELF?page=$prevpage><<</a> "; // Previous Page Link
}
if ($page == $total_pages)
{
$to = $total_pages;
}
elseif ($page == $total_pages-1)
{
$to = $page+1;
}
elseif ($page == $total_pages-2)
{
$to = $page+2;
}
else
{
$to = $page+3;
}
if ($page == 1 || $page == 2 || $page == 3)
{
$from = 1;
}
else
{
$from = $page-3;
}
for ($i = $from; $i <= $to; $i++)
{
if ($i == $total_results) $to=$total_results;
if ($i != $page)
{
echo "<a href=$PHP_SELF?showold=yes&page=$i>$i</a>";
}
else
{
echo "<b><font face=Verdana size=2>[$i]</font></b>";
}
if ($i != $total_pages)
echo " ";
}
if ($page != $total_pages)
{
$nextpage = $page + 1;
echo " <a href=$PHP_SELF?page=$nextpage>>></a> "; // Next Page Link
echo " <a href=$PHP_SELF?page=$total_pages>Last >></a>"; // Last Page Link
echo "</font>";
}
?>
Als dit een nieuwere versie van php is, kan het daar aan liggen...
En welke regel was regel 95?
In mijn eerste bericht heb ik aangegeven dat de foutmelding in 95 staat.
Dit is de laatste regel van het script :(
Sluit For EN if eens af !!!
Quote:
Welke variabele staat tussen quotjes dan??
Welke niet..
En verder als de fout in de regel ?> zit is het meestal zo dat je een } vergeten bent... Das makkelijk te voorkomen door zelf duidelijk in te springen met tabs.
@kameel -> je kan editen :P
-edit :) -
Is er ergens een lijstje met wanneer je beginner / diehard 31337 enzo bent hier?
Gewijzigd op 12/08/2004 22:11:00 door dutchcamel
Ik denk dat ik wel het hoogste zit!
1811 posts :)
@Mitch OPSCHEPPER :p Ik zit hier met m'n weet ik veel hoeveel posts :x Anyway, ik ben een noob dus das normaal :p