background image

<!--{foreach from=$gblist item=item}--> 
<table id="t<!--{$item.id}-->" width="700" border="0" cellspacing="0" 
cellpadding="0" class="tb"> 
<tr> 
<td class="bg"><b>[<!--{$item.username}-->]</b> 发表于:<!--
{$item.insert_time}--></td> 
</tr> 
<tr> 
<td><!--{$item.content}--> 
<br /> 
<!--{if $item.user_file}--> 
附件:<a target="_blank" href="uploads/<!--{$item.user_file}-->"><!--
{$item.user_file}--></a> 
<!--{/if}--> 
</td> 
</tr> 
<tr> 
<td align="right"><!--{if $item.user_id==$smarty.session.user_id}--><a 
href="add.php?id=<!--{$item.id}-->">修改</a> <a 
href="javascript:delItem('<!--{$item.id}-->')">删除</a>& lt;!--{/if}--></td> 
</tr> 
</table> 
<!--{/foreach}--> 
<!--{$pagePanel}--> 
<script> 
function delItem (id) { 
$.get('delete.php?id='+id,null,function (msg) { 
if ('1'==msg) { 
$('#t'+id).remove(); 
} else { 
alert(msg); 

}); 

</script> 
</body> 
</html>

delete.php :
<?php 

require('common.php'); 
// 查询出留言信息 
$q = $query->query('select * from gb_content where id='.intval($_GET['id'])); 
$rs = $query->fetch_array($q);