2012-02-15 67 views
1

我有這個腳本輸出所有從表稱爲文章。PHP/MySQL - 隨機分號輸出

如果我加載這個腳本,在我的桌子前面有像這樣的隨機分號; ;

這是我的代碼:

if($_SESSION['rights'] == 2){ 
    include_once "scripts/mysql123.php"; 

    //menu 
    echo "<a href=\"newarticle.php\">Pridať nový článok</a><br/><br/><br/>"; 

    //Connect to MySQL Server 
    mysql_connect($dbhost, $dbuser, $dbpass); 

    //Select Database 
    mysql_select_db($dbname); 

    //display all users 
    echo "<table class=\"tableClients\" style=\"text-align: center;\">"; 
    echo "<tr>"; 
     echo " 
      <th>Id</th> 
      <th>Názov článku</th> 
      <th>Vytvorené</th> 
      <th>Upraviť</th> 
      <th>Vymazať</th> 
     \n"; 
     echo "</tr>\n"; 
    $qry_result = mysql_query("SELECT * FROM `Articles`") or die(mysql_error()); 
    while($qry = mysql_fetch_array($qry_result)){ 
     echo "<tr>\n"; 
     echo " 
      <td>".$qry[id]."</td> 
      <td>".$qry[articlename]."</td> 
      <td>".date("d.m.Y H:m:i",$qry[created])."</td> 
      <td><a href=\"editarticle.php\"><img src=\"img/tools.png\" width=\"30\" /></a></td>; 
      <td><a href=\"deletearticle.php\"><img src=\"img/delete.png\" width=\"30\" /></a></td>; 
     \n"; 
     echo "</tr>\n"; 
    } 

    echo "</table>\n"; 


    //Close connection 
    mysql_close(mysql_connect($dbhost, $dbuser, $dbpass)); 
} 
else{ 
    echo "Musíte mať administrátorské práva."; 
} 

回答

4

你是你自己它們輸出作爲長字符串文字的一部分,在這些線路的兩端:

<td><a href=\"editarticle.php\"><img src=\"img/tools.png\" width=\"30\" /></a></td>; 
<td><a href=\"deletearticle.php\"><img src=\"img/delete.png\" width=\"30\" /></a></td>; 

只需卸下分號那裏。

+0

耶穌,我很盲目......非常感謝。 – Wr1t3r 2012-02-15 20:48:33