前端之家收集整理的这篇文章主要介绍了
PHP与SQL语句常用大全,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
本文给大家介绍PHP与sql语句常用大全,具体代码如下所述:
PHP;">
action="savereg.
PHP"
PHP
if(
MysqL_query("insert into tb_user(usernc,userpwd,truename,qq,tel,address,regtime,sex,usertype) values('".$usernc."','".md5(trim($_POST["userpwd"]))."','".$_POST["truename"]."','".$_POST["email"]."','".$_POST["qq"]."','".$_POST["tel"]."','".$ip."','".$_POST["address"]."','".$_POST["face"]."','".date("Y-m-d H:i:s")."','".$_POST["sex"]."','0')",$conn)){
if($_SESSION["unc"]!=""){
session_unregister("unc");
}
session_register("unc");
$_SESSION["unc"]=$usernc;
echo "";
}else{
echo "";
}
?>
PHP
$
sql=
MysqL_query("select count(*) as total from tb_leaveword ",$conn);//把
查询的结果存入total中
$info=
MysqL_fetch_array($
sql);
$total=$info[total];
if($total==0){
echo "
对不起,暂无留言!
";
}else{
if(!isset($_GET["page"]) || !is_numeric($_GET["page"])){
$page=1;
}else{
$page=intval($_GET["page"]);
}
$pagesize=3;
if($total%$pagesize==0){
$pagecount=intval($total/$pagesize);
}else{
$pagecount=ceil($total/$pagesize);
}
$
sql=
MysqL_query("select * from tb_leaveword order by createtime desc limit ".($page-1)*$pagesize.",$pagesize ",$conn);
while($info=
MysqL_fetch_array($
sql)){
?>
主题:PHP?id="+x,"newframe","top=100,left=200,width=450,height=280,menubar=no,location=no,scrollbars=no,status=no");
}
<?php
if($_SESSION["unc"]!=""){
$sqld=mysql_query("select usertype from tb_user where usernc='".$_SESSION["unc"]."'",$conn);
$infod=mysql_fetch_array($sqld);
if($infod["usertype"]==1){
?>
<a href="javascript:if(window.confirm('确定删除该留言信息么?')==true){window.location.href='deleteleaveword.php?id=<?php echo $info[id];?>';}" class="a1">删除
<?php
}
}
?>
" />
"/>
<table width="550" height="25" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="351"><div align="left">共有留言<?php echo $total;?>条每页显示<?php echo $pagesize;?>条第<?php echo $page;?>页/共<?php echo $pagecount;?>页</td>
<td width="199"><div align="right"><a href="<?php echo $_SERVER["PHP_SELF"]?>?page=1" class="a1">首页<a href="<?php echo $_SERVER["PHP_SELF"]?>?page=<?php
if($page>1)
echo $page-1;
else
echo 1;
?>" class="a1">上一页<a href="<?php echo $_SERVER["PHP_SELF"]?>?page=<?PHP
if($page<$pagecount)
echo $page+1;
else
echo $pagecount;
?>
以上所述是小编给大家介绍的PHP与sql语句常用大全,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的,在此也非常感谢大家对编程之家网站的支持!
原文链接:https://www.f2er.com/php/18281.html