Parse error: syntax error, unexpected T_STRING
Na enkele malen proberen uit te vinden waar het ergens fout gaat krijg ik nog steeds de foutmelding: Parse error: syntax error, unexpected T_STRING on line 1.
Deze script eens nakijken.
Alvast bedankt,
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
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
<?php
function mysql_connect();
{
include "configs/script_config2.php";
}
$sexes = array('M', 'F');
$levels = array('-100' => "Banned", '100' => "L2AngelZ-Sherif", '50' => "L2AngelZ-Azubi");
$FORM = "<table border='1'>
<tr>
<th class='Stil5' align=center>Pos.</th>
<th class='Stil5' align=center>Char.Name</th>
<th class='Stil5' align=center>PvP Kills</th>
<th class='Stil5' align=center>Clan</th>
</tr>";
$query_chars = "select char_name,pvpkills,clanid from characters WHERE accesslevel=0 AND pvpkills >= 1 order by pvpkills desc limit 10;";
connect();
$link = mysql_query($query_chars);
$i=1;
$r=255;
while ( $row=mysql_fetch_row($link) )
{
$query = "select clan_name from clan_data where clan_id=$row[2]";
$link2 = mysql_query($query);
$clan = mysql_fetch_row($link2);
$FORM .= "<tr>
<td class='Stil5' align=center>$i</span></td>
<td class='Stil5' align=center>$row[0]</td>
<td class='Stil5' align=center>$row[1]</td>
<td class='Stil5' align=center>[".$clan[0]."]</td>
</tr>";
$i++;
$r -= 0;
}
mysql_close();
echo $FORM;
?>
function mysql_connect();
{
include "configs/script_config2.php";
}
$sexes = array('M', 'F');
$levels = array('-100' => "Banned", '100' => "L2AngelZ-Sherif", '50' => "L2AngelZ-Azubi");
$FORM = "<table border='1'>
<tr>
<th class='Stil5' align=center>Pos.</th>
<th class='Stil5' align=center>Char.Name</th>
<th class='Stil5' align=center>PvP Kills</th>
<th class='Stil5' align=center>Clan</th>
</tr>";
$query_chars = "select char_name,pvpkills,clanid from characters WHERE accesslevel=0 AND pvpkills >= 1 order by pvpkills desc limit 10;";
connect();
$link = mysql_query($query_chars);
$i=1;
$r=255;
while ( $row=mysql_fetch_row($link) )
{
$query = "select clan_name from clan_data where clan_id=$row[2]";
$link2 = mysql_query($query);
$clan = mysql_fetch_row($link2);
$FORM .= "<tr>
<td class='Stil5' align=center>$i</span></td>
<td class='Stil5' align=center>$row[0]</td>
<td class='Stil5' align=center>$row[1]</td>
<td class='Stil5' align=center>[".$clan[0]."]</td>
</tr>";
$i++;
$r -= 0;
}
mysql_close();
echo $FORM;
?>
Gewijzigd op 01/01/1970 01:00:00 door Mathijs
Het zal niet de fout zijn lijkt mij, maar je kan geen bestaande function declareren op regel 3.
Dat klopt niet. Die ; moet weg.
@ SanThe: Maar een function het moet in enig opzicht wel kunnen of is het bter om: function connect() i.p.v. function mysql_connect() te vermelden
de functie mysql_connect bestaat al. Die kun je niet nogmaals aanmaken. Je kunt je functie dan wel connect noemen.
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
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
$db_user = "xxxx";
$db_pass = "xxxxx";
$db_name = "xxx";
$db_serv = "xxxx";
$res = mysql_connect ( $db_serv, $db_user, $db_pass ) or die ("Coudn't connect to [$db_serv]");
$resdb = mysql_select_db ( "$db_name",$res );
return $res;
?>
$db_user = "xxxx";
$db_pass = "xxxxx";
$db_name = "xxx";
$db_serv = "xxxx";
$res = mysql_connect ( $db_serv, $db_user, $db_pass ) or die ("Coudn't connect to [$db_serv]");
$resdb = mysql_select_db ( "$db_name",$res );
return $res;
?>
Btw dit is de volledige pagina:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Mirrored from l2Unknown.com/mmo/text/table_toppvp.html by HTTrack Website Copier/3.x [XR&CO'2008], Fri, 13 Feb 2009 14:10:04 GMT -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Tabela_News</title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana;
font-size: 9pt;
color: #999999;
}
a {
font-family: Verdana;
font-size: 9pt;
color: #FFFFFF;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #FFFFFF;
}
a:hover {
text-decoration: underline;
color: #666666;
}
a:active {
text-decoration: none;
color: #FFFFFF;
}
.style4 {color: #C3B38F}
.style6 {color: #D3AD4A}
.style8 {color: #D3AD4A; font-weight: bold; }
.style9 {
color: #FFFFFF;
font-weight: bold;
}
.style10 {color: #FFFFFF}
-->
</style></head>
<body style="background-color: transparent">
<table width="475" border="0">
<tr>
<td>
<strong><span class="style6">Top PvP:</span></strong><br><br>
A player who has recorded the highest score in a class throughtout the entire server in Player vs. Player combat. Once the list is implemented there will be 100 people listed here.
<strong><span class="style6"><br><br>
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
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
<?
function mysql_connect()
{
include "configs/script_config2.php";
}
$sexes = array('M', 'F');
$levels = array('-100' => "Banned", '100' => "L2AngelZ-Sherif", '50' => "L2AngelZ-Azubi");
$FORM = "<table border='1'>
<tr>
<th class='Stil5' align=center>Pos.</th>
<th class='Stil5' align=center>Char.Name</th>
<th class='Stil5' align=center>PvP Kills</th>
<th class='Stil5' align=center>Clan</th>
</tr>";
$query_chars = "select char_name,pvpkills,clanid from characters WHERE accesslevel=0 AND pvpkills >= 1 order by pvpkills desc limit 10;";
connect();
$link = mysql_query($query_chars);
$i=1;
$r=255;
while ( $row=mysql_fetch_row($link) )
{
$query = "select clan_name from clan_data where clan_id=$row[2]";
$link2 = mysql_query($query);
$clan = mysql_fetch_row($link2);
$FORM .= "<tr>
<td class='Stil5' align=center>$i</span></td>
<td class='Stil5' align=center>$row[0]</td>
<td class='Stil5' align=center>$row[1]</td>
<td class='Stil5' align=center>[".$clan[0]."]</td>
</tr>";
$i++;
$r -= 0;
}
mysql_close();
echo $FORM;
?>
function mysql_connect()
{
include "configs/script_config2.php";
}
$sexes = array('M', 'F');
$levels = array('-100' => "Banned", '100' => "L2AngelZ-Sherif", '50' => "L2AngelZ-Azubi");
$FORM = "<table border='1'>
<tr>
<th class='Stil5' align=center>Pos.</th>
<th class='Stil5' align=center>Char.Name</th>
<th class='Stil5' align=center>PvP Kills</th>
<th class='Stil5' align=center>Clan</th>
</tr>";
$query_chars = "select char_name,pvpkills,clanid from characters WHERE accesslevel=0 AND pvpkills >= 1 order by pvpkills desc limit 10;";
connect();
$link = mysql_query($query_chars);
$i=1;
$r=255;
while ( $row=mysql_fetch_row($link) )
{
$query = "select clan_name from clan_data where clan_id=$row[2]";
$link2 = mysql_query($query);
$clan = mysql_fetch_row($link2);
$FORM .= "<tr>
<td class='Stil5' align=center>$i</span></td>
<td class='Stil5' align=center>$row[0]</td>
<td class='Stil5' align=center>$row[1]</td>
<td class='Stil5' align=center>[".$clan[0]."]</td>
</tr>";
$i++;
$r -= 0;
}
mysql_close();
echo $FORM;
?>
</tr>
</table>
</body>
<!-- Mirrored from l2Unknown.com/mmo/text/table_toppvp.html by HTTrack Website Copier/3.x [XR&CO'2008], Fri, 13 Feb 2009 14:10:04 GMT -->
</html>
Gewijzigd op 01/01/1970 01:00:00 door Mathijs
Shorttags php staan zeker aan?
De error komt volgens mij door
Hij denkt dat die
Ik moet de volgende keer een beetje beter kijken :)
Ik heb het een en ander aangepast maar krijg nu de volgende melding:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/l2unknow/public_html/text/table_toppvp2.php on line 75
De query zal mislukt zijn.
$query_chars = "select char_name,pvpkills,clanid from characters WHERE accesslevel=0 AND pvpkills >= 1 order by pvpkills desc limit 10;";
Ja, dus foutafhandeling inbouwen, dan zie je wat er fout gaat.
door kolomnamen tussen backticks(`) te plaatsen loop je ook niet tegen problemen aan met reserved-words.
Jim schreef op 26.01.2010 15:18:
door kolomnamen tussen backticks(`) te plaatsen loop je ook niet tegen problemen aan met reserved-words.
Slecht advies. Nooit backtics gebruiken. Je fiets heeft toch ook geen houten wielen zodat je nooit een lekke band kan krijgen.
Bedankt voor al jullie support.
care to share