我有这个脚本来输出名为Articles的表中的所有内容。
如果我加载这个脚本,那么在我的桌子前面会有像这样的随机分号; ;
这是我的代码:
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.";
}
答案 0 :(得分: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>;
只需删除那里的分号。