求php+html增删改查代码
答案:2 悬赏:50 手机版
解决时间 2021-04-05 21:13
- 提问者网友:我没有何以琛的痴心不悔
- 2021-04-05 06:19
求php+html增删改查代码
最佳答案
- 五星知识达人网友:人類模型
- 2021-04-05 06:51
这很简单吧..
$conn=mysql_connect("localhost","root","fengyun666");//数据库ip 用户名 密码
mysql_select_db("xuexiao",$conn); //需要使用的数据库。。
$zi_sql="SELECT * FROM users "; 查询语句(假设你的用户表是users)
$zi_aaa=mysql_query($zi_sql);
while($row = mysql_fetch_array($zi_aaa)){
echo $row[name]; //输出 用户名(你的用户名字段是 name)
}
?>
$conn=mysql_connect("localhost","root","fengyun666");//数据库ip 用户名 密码
mysql_select_db("xuexiao",$conn); //需要使用的数据库。。
$zi_sql="SELECT * FROM users "; 查询语句(假设你的用户表是users)
$zi_aaa=mysql_query($zi_sql);
while($row = mysql_fetch_array($zi_aaa)){
echo $row[name]; //输出 用户名(你的用户名字段是 name)
}
?>
全部回答
- 1楼网友:末日狂欢
- 2021-04-05 07:04
html页面如下
点击链接
用户名:$v['username'];
分页:
php 页面
global $page,$select_from,$select_limit,$pagenav;
$cmsModel = $this->_getModelByName('CmsModel');
$arr = Array();
$page = empty($_GET["page"])?1:$_GET["page"];
$result1 = $cmsModel->selectt();
$rows = mysql_num_rows($result1);
$page_size = 10;
//分页
$page_count = ceil($rows/$page_size);
if($page <= 1 || $page == '') $page = 1;
if($page >= $page_count) $page = $page_count;
$select_limit = $page_size;
$select_from = ($page - 1) * $page_size.',';
$pre_page = ($page == 1)? 1 : $page - 1;
$next_page= ($page == $page_count)? $page_count : $page + 1 ;
$pagenav .= "第 $page/$page_count 页 共 $rows 条记录 ";
if($page>1){
$pagenav .= "首页 ";
$pagenav .= "前一页 ";
}
if($page < $page_count)
{
$pagenav .= "后一页 ";
$pagenav .= "末页";
}
$pagenav.=" 跳到\n";
for($i=1;$i<=$page_count;$i++){
if($i==$page) $pagenav.="\n";
else $pagenav.="\n";
}
//
$sql = "select * from cms limit $select_from $select_limit";
$result = $cmsModel->query($sql);
$i=0;
$a=($page-1)*$page_size;
while(@$row = mysql_fetch_assoc($result)){
++$i;
$d = $i+$a;
$row['s']=$d;
$arr[]=$row;
}
$num = count($arr);
$this->view->assign("num",$num);
$this->view->assign('pagenav',$pagenav);
$this->view->assign('arr',$arr);
你可以看看
点击链接
用户名:$v['username'];
分页:
php 页面
global $page,$select_from,$select_limit,$pagenav;
$cmsModel = $this->_getModelByName('CmsModel');
$arr = Array();
$page = empty($_GET["page"])?1:$_GET["page"];
$result1 = $cmsModel->selectt();
$rows = mysql_num_rows($result1);
$page_size = 10;
//分页
$page_count = ceil($rows/$page_size);
if($page <= 1 || $page == '') $page = 1;
if($page >= $page_count) $page = $page_count;
$select_limit = $page_size;
$select_from = ($page - 1) * $page_size.',';
$pre_page = ($page == 1)? 1 : $page - 1;
$next_page= ($page == $page_count)? $page_count : $page + 1 ;
$pagenav .= "第 $page/$page_count 页 共 $rows 条记录 ";
if($page>1){
$pagenav .= "首页 ";
$pagenav .= "前一页 ";
}
if($page < $page_count)
{
$pagenav .= "后一页 ";
$pagenav .= "末页";
}
$pagenav.=" 跳到
for($i=1;$i<=$page_count;$i++){
if($i==$page) $pagenav.="\n";
else $pagenav.="\n";
}
//
$sql = "select * from cms limit $select_from $select_limit";
$result = $cmsModel->query($sql);
$i=0;
$a=($page-1)*$page_size;
while(@$row = mysql_fetch_assoc($result)){
++$i;
$d = $i+$a;
$row['s']=$d;
$arr[]=$row;
}
$num = count($arr);
$this->view->assign("num",$num);
$this->view->assign('pagenav',$pagenav);
$this->view->assign('arr',$arr);
你可以看看
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯