samedi 25 avril 2015

Parse error: syntax error, unexpected T_STRING on line 12 [duplicate]


This question already has an answer here:

Hello all I ve a problem with php editing so my problem is:

Parse error: syntax error, unexpected 'select' (T_STRING) in C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\projects\toppvp.php on line 12

and here is my php file

<

    ?php

    $db_user = "root";
    $db_pass = "";
    $db_name_gs = "l2jgs";
    $db_name_ls = "l2jls";
    $db_name_cs = "l2jcs";
    $res = mysql_connect ( $db_serv, $db_user, $db_pass ) or die ("Coudn't connect to [$db_serv]");
        $resdb = mysql_select_db ( $db_name_gs, $res ) or die (mysql_error("Cannot connect to Game Server"));
        $resdb = mysql_select_db ( $db_name_ls, $res ) or die (mysql_error("Cannot connect to Login Server"));
        $resdb = mysql_select_db ( $db_name_cs, $res ) or die (mysql_error("Cannot connect to Community Server));
    $res="select characters.char_name,characters.pvpkills,char_templates.ClassName,characters.online,characters.accesslevel from characters,char_templates where characters.classid=char_templates.Classid order by characters.pvpkills DESC LIMIT 20";
    echo"<html><head></head><body bgcolor='#000000' style='color:rgb(200,200,200)'>";
    echo "<table  border='2' align=center width=440>";
    echo "<tr><th>Nr</th><th>Name</th><th>PvP Kills</th><th>Main class</th><th>Status</th></tr>\n";
    if ($result=mysqli_query($con, $sql)or die("Bed Sql syntax")) {
      $nr=1;
    while ($row=mysql_fetch_row($result)) {
         echo "<tr><td align=center>".$nr."</td>";
         $nr++;
        echo "<td align=center>".$row[0]."</td>";
        echo "<td align=center>".$row[1]."</td>";
        echo "<td align=center>".$row[2]."</td>";
        if($row[4]==0)
        {   
            if($row[3])
            {echo "<td align=center style='color:rgb(0,255,0)'>Online</td></tr>\n"; }
             else{echo "<td align=center style='color:rgb(255,0,0)'>Offline</td></tr>\n";}
        }
         else{echo "<td align=center style='color:rgb(255,0,0)'>Hidden</td></tr>\n";}
    }
    }else{ echo "<!-- SQL Error ".mysql_error()." -->";}

    echo "</table></body></html>";


    ?>

I searched 2 hours to find an solution and i saw same question like mine on this forum but didnt find a suitable one :(

Would appreciate if someone help me Thank You,


Aucun commentaire:

Enregistrer un commentaire