PHP编程:增删改查

时间:2022-04-15 07:45:09
数据查询,列表页面显示
<?php
include_once "config/SqlConn.php";
$db=new DBHelper();
$sql="select arid,title from huilin_article limit 20";
$resu=$db->Query($sql);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link href="Styles/Site.css" rel="stylesheet" type="text/css" />
<link href="Styles/table.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="JS/jquery-1.8.3.min.js"></script>
<script type="text/javascript">
$(function () {

});
</script>
</head>
<body>
<table style="width:600px;">
<?php
while($modelList=mysql_fetch_array($resu))
{

?>
<tr>
<td width="10%"><?php echo $modelList["arid"]; ?></td>
<td width="70%"><?php echo $modelList["title"]; ?></td>
<td width="10%">[<a href='news_edit.php?id=<?php echo $modelList["arid"]; ?>' target="_blank">编辑</a>]</td>
<td width="10%">[<a href='DBHandle/Action_Art.php?id=<?php echo $modelList["arid"]; ?>&cmd=del'>删除</a>]</td>
</tr>
<?php
}

$rows=mysql_num_rows($resu);

?>
</table>
<hr>
总共有<?php echo $rows ?>条记录
</body>
</html>