<a href="add.php">add new product</a><br>
<br>
<?php
include("mysql.php");
$result = mysql_query("SELECT * FROM gallery ");
$just = mysql_fetch_array($result);
$num=mysql_num_rows($result);
$table="";
$table.="<td>delete</td>";
$table.="<td>update</td>";
if ($num > 0) {
$i=0;
while($just = mysql_fetch_array($result))
{
$num=mysql_num_rows($result);
{
$table .= "<tr>";
$table .= "<td><a href=\"delete.php?name=".$just['name']."&id=".$just['id']."\">".$just['title']."</a></td>";
$table .= "<td><a href=\"update.php?description=".$just['description']."&title=".$just['title']."&id=".$just['id']."\">".$just['title']."</a></td>";
}
$table .= "</tr>";
while ($i < $num) {
$name = stripslashes(mysql_result($result,$i,"name"));
$title = stripslashes(mysql_result($result,$i,"title"));
$description = stripslashes(mysql_result($result,$i,"description"));
++$i; }
}
}
else { $table = '<tr><td colspan="2" align="center">Nothing found</td></tr>'; }
?>
<table border="1" cellpadding="1" cellspacing="2"><? echo $table ?></table>
早上好,在上面的代碼iam試圖創建一個2列的表刪除和更新,能夠通過這個頁面管理mysql,但我只得到1行mysql表雖然我預計4(4行被保存在MySQL表) 有什麼錯在這裏,在此先感謝我只使用這段代碼得到一個結果
另外,你真的需要,以防止[XSS漏洞(http://stackoverflow.com/questions/3129899/what-are-the-common-defenses-against-xss)。 – DCoder 2012-04-28 04:50:52