Avatar billede woodplace Nybegynder
04. august 2004 - 19:04 Der er 3 kommentarer og
2 løsninger

Parse error: parse error, unexpected T_STRING

Hej
jeg får en fejl på linge 104 i denne her fil, er der nogen af jer der kan se hvad der er galt?
MVH
woodplace

(Linge 104 er her: src='http://darkknights.dk/bhd/modules/Chronos/templates/server_offline.gif'        alt="server_offline.gif" title="Offline" border='0'></a></center><br>";

<?php
// Database settings
$dbhost = "XXXXXX"; // Database host
$dbname = "XXXXXXX"; // Database name
$dbusername = "XXXXXXXX"; // Database user name
$dbuserpw = "XXXXXXX"; // Database password
$dbtable = "chronos_servers"; // table of servers

$link_id = mysql_connect($dbhost,$dbusername,$dbuserpw)
or die("Could not connect to MySQL.");
//echo("Connection Successfull.<br>");
$selected = mysql_select_db($dbname,$link_id)
or die("Could not select database");
//echo("Selection Successfull.");


$time = time();
$offline = $time - 120;

$sql = sql_query("SELECT * FROM chronos_servers WHERE time>$offline ORDER BY name", $dbi);
$content1 = "";

$servernum = sql_num_rows($sql, $dbi);
if ($servernum >= 1) {

$content1 .= "<table width='100%' celspacing='1'>";

while($result = sql_fetch_array($sql, $dbi)) {
$players = "";
$player_color = "";

$codedmap = $result["map_name"];

$result["server_name"] = htmlspecialchars(base64_decode($result["server_name"]));
$result["map_name"] = htmlspecialchars(base64_decode($result["map_name"]));
$result[server_name] = ereg_replace('~[0-9]', '', $result[server_name]);
$result[map_name] = ereg_replace('~[0-9]', '', $result[map_name]);

if ($result["game_type"] == "Deathmatch") $game_type = "DM";
if ($result["game_type"] == "Team Deathmatch") $game_type = "TDM";
if ($result["game_type"] == "Team King of the Hill") $game_type = "TKOTH";
if ($result["game_type"] == "Search and Destroy") $game_type = "S&D";
if ($result["game_type"] == "Attack and Defend") $game_type = "A&D";
if ($result["game_type"] == "Capture the Flag") $game_type = "CTF";
if ($result["game_type"] == "Flagball") $game_type = "FB";

$player_names = explode("n", $result["player_names"]);
$player_teams = explode("n", $result["player_teams"]);
$playercount = 1;
for($i = 0; $i < count($player_names); $i++) {
$player_name = htmlspecialchars(base64_decode($player_names[$i]));
$player_team = $player_teams[$i];

if ($player_team == "Blue") $player_color = "#1796CB";
if ($player_team == "Red") $player_color = "#E3553C";
if ($player_team == "Yellow") $player_color = "yellow";
if ($player_team == "Violet") $player_color = "violet";
if ($player_team == "Green") $player_color = "#44DD44";
if ($player_team == "None") $player_color = "#44DD44";

if ($player_name == "SYSOP =422=") {
$result[num_players]--;
} else {
$players .= "[<font color='".$player_color."'><b>".$player_name."</b></font>] ";
$playercount++;
}
}

if(!$bg) {
$bg = $bgcolor2;
} elseif ($bg == $bgcolor2) {
$bg = $bgcolor3;
} elseif ($bg == $bgcolor3) {
$bg = $bgcolor2;
}

$content1 .= "<tr><td align='center' bgcolor='$bg'>";
$content1 .= "<a href='http://ozisquad.com/chronos/index.php?action=servers&id=".$result[id]."' class='special1'>" ;
$content1 .= "<img src='http://ozisquad.com/chronos/templates/online.gif' alt='Online.gif' title='Online' border='0'><br>";
$content1 .= "<b>".$result[server_name]."</b><br>";
$sql2 = sql_query("select * from chronos_maps where name='$codedmap'", $dbi);
$result2 = sql_fetch_array($sql2, $dbi);
if ($result2["image"] && $servernum < 3) {
$content1 .= "<img src='http://ozisquad.com/chronos/$result2[image]' alt='$result[map_name]' title='$result[map_name]' width='125' height='94' border='0'><br>";
} else {
$content1 .= $result[map_name]."<br>";
}
$content1 .= $result[game]." (".$game_type.")<br>";
$content1 .= $result[num_players]." of ".$result[max_players]."</a><br>";
if ($result["player_names"] && $playercount > 1) { // && $servernum == 1
$content1 .= "<MARQUEE behavior='scroll' align='center' direction='left' height='12' scrollamount='1' scrolldelay='20' onmouseover='this.stop()' onmouseout='this.start()'>"
."<b>players online:</b> $players"
."</MARQUEE>";
}
$content1 .= "</td></tr>";
}


$content1 .= "</table>";

}

if (!$content1) {
$content = "<br><center><img src='http://darkknights.dk/bhd/modules/Chronos/templates/server_offline.gif'        alt="server_offline.gif" title="Offline" border='0'></a></center><br>";
} else {
$content = "<br>$content1<br>";
}
?>
Avatar billede intenz Novice
04. august 2004 - 19:46 #1
$content = "<br><center><img src='http://darkknights.dk/bhd/modules/Chronos/templates/server_offline.gif'        alt="server_offline.gif" title="Offline" border='0'></a></center><br>";

skal være

$content = "<br><center><img src='http://darkknights.dk/bhd/modules/Chronos/templates/server_offline.gif'        alt=\"server_offline.gif\" title=\"Offline\" border='0'></a></center><br>";

ellers skal du bare ændre alle " til '
Avatar billede woodplace Nybegynder
05. august 2004 - 20:08 #2
efter at jeg har rettet linge 104 til
$content = "<br><center><img src='http://darkknights.dk/bhd/modules/Chronos/templates/server_offline.gif'        alt=\"server_offline.gif\" title=\"Offline\" border='0'></a></center><br>";

Får jeg en fejl i linge 20

$sql = sql_query("SELECT * FROM chronos_servers WHERE time>$offline ORDER BY name", $dbi);

Hvad skal jeg rette her?
Scripet er til at uploade status fra en BHD server (black hawk down)
Avatar billede coderdk Praktikant
07. august 2004 - 02:09 #3
Ville hjælpe hvis du fortalte hvilken fejl du får ;)

Men jeg kan næsten gætte mig til at du har skrevet sql_query i stedet for mysql_query ;)
Avatar billede coderdk Praktikant
07. august 2004 - 02:10 #4
Og samme med sql_fetch_array => mysql_fetch_array
Avatar billede woodplace Nybegynder
07. august 2004 - 12:15 #5
Den køre nu efter at jeg har rettet alle $sql til $mysql

Tak for hjælpen
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester