Hoi,

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,
<?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;

?>
Het zal niet de fout zijn lijkt mij, maar je kan geen bestaande function declareren op regel 3.
function mysql_connect();

Dat klopt niet. Die ; moet weg.
@ Aar: Oke, Zal de ; weghalen achter de function mysql_connect
@ 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.
Mogelijk zit er iets fout in deze script?

<?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;



?>

Btw dit is de volledige pagina:

<?xml version="1.0" encoding="utf-8"?><!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>

<?
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;

?></span></strong></td>
</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>
EDIT

Mijn fout.. Verkeerde gelezen, sorry
Haal je inloggevens uit je post.

Shorttags php staan zeker aan?
De error komt volgens mij door <?xml en denkt php dat daar het script begint.
De error zegt dat het fout gaat op regel 1, dat is deze:
<?xml version="1.0" encoding="utf-8"?>

Hij denkt dat die <?xml al php is. Je moet je shorttags uitzetten dan ben je van dit probleem af.
Bedankt TJVB,
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
Foutafhandeling inbouwen.
De query zal mislukt zijn.

Reageren