标签:des android style blog http color io os ar
在做添加时写是否已经有该文件
$_sql1 = "SELECT * FROM tb_user where userName = {$_clean[‘userName‘]} "; $_result1 = _query($_sql1); $_rows1 = _fetch_array($_result1); if ( $_rows1>0 ){ echo "<script>alert(‘帐号已经存在,请更换账号‘);location.href=‘user.php‘</script>"; exit(); } else{ $_sqlAdd = "INSERT INTO tb_user (addDates,addIP,userName,userEmail,u
排序总动添加
$_sql1 = "SELECT * FROM tb_GoodsInfo"; $_result1 = _query($_sql1); $_rows1 = _num_rows($_result1); $_sort = $_rows1 + 1;
一个增删改查
<?php require ‘includes/common.inc.php‘; session_start(); if ( !isset($_SESSION[‘username‘]) ) { _location(‘请先登录!‘,‘login.php‘); } define(‘SCRIPT‘,‘picadvert‘); if ( @$_GET[‘action‘] == ‘add‘ ) { $_clean = array(); $_clean[‘weizi‘] = _check($_POST[‘weizi‘]); $_clean[‘picName‘] = _check($_POST[‘picName‘]); $_clean[‘picImg‘] = _check($_POST[‘picImg‘]); $_clean[‘picLink‘] = _check($_POST[‘picLink‘]); $_clean[‘isFreeze‘] = _check($_POST[‘isFreeze‘]); $_sqlAdd = "INSERT INTO tb_picadvert VALUES (null,‘{$_clean[‘weizi‘]}‘,0,‘{$_clean[‘picName‘]}‘,‘{$_clean[‘picImg‘]}‘,‘{$_clean[‘picLink‘]}‘,‘{$_clean[‘isFreeze‘]}‘)"; _query($_sqlAdd); if ( _affected_rows() == 1 ) { _close(); _alert_back(‘添加成功!‘); } else { _close(); _alert_back(‘添加失败!‘); } } ?> <?php global $_pagesize,$_pagenum; if ( !isset($_GET[‘weizi‘])) { _page(‘SELECT id FROM tb_picadvert‘,10); $_sql = "SELECT * FROM tb_picadvert LIMIT $_pagenum,$_pagesize"; } elseif ( @$_GET[‘weizi‘] == 0 ) { _page(‘SELECT id FROM tb_picadvert WHERE weizi = 0‘,10); $_sql = "SELECT * FROM tb_picadvert WHERE weizi = 0 LIMIT $_pagenum,$_pagesize"; } elseif ( @$_GET[‘weizi‘] == 1 ) { _page(‘SELECT id FROM tb_picadvert WHERE weizi = 1‘,10); $_sql = "SELECT * FROM tb_picadvert WHERE weizi = 1 LIMIT $_pagenum,$_pagesize"; } elseif ( @$_GET[‘weizi‘] == 2 ) { _page(‘SELECT id FROM tb_picadvert WHERE weizi = 2‘,10); $_sql = "SELECT * FROM tb_picadvert WHERE weizi = 2 LIMIT $_pagenum,$_pagesize"; } elseif ( @$_GET[‘weizi‘] == 3 ) { _page(‘SELECT id FROM tb_picadvert WHERE weizi = 3‘,10); $_sql = "SELECT * FROM tb_picadvert WHERE weizi = 3 LIMIT $_pagenum,$_pagesize"; } elseif ( @$_GET[‘weizi‘] == 4 ) { _page(‘SELECT id FROM tb_picadvert WHERE weizi = 4‘,10); $_sql = "SELECT * FROM tb_picadvert WHERE weizi = 4 LIMIT $_pagenum,$_pagesize"; } elseif ( @$_GET[‘weizi‘] == 5 ) { _page(‘SELECT id FROM tb_picadvert WHERE weizi = 5‘,10); $_sql = "SELECT * FROM tb_picadvert WHERE weizi = 5 LIMIT $_pagenum,$_pagesize"; } elseif ( @$_GET[‘weizi‘] == 6 ) { _page(‘SELECT id FROM tb_picadvert WHERE weizi = 6‘,10); $_sql = "SELECT * FROM tb_picadvert WHERE weizi = 6 LIMIT $_pagenum,$_pagesize"; } elseif ( @$_GET[‘weizi‘] == 7 ) { _page(‘SELECT id FROM tb_picadvert WHERE weizi = 7‘,10); $_sql = "SELECT * FROM tb_picadvert WHERE weizi = 7 LIMIT $_pagenum,$_pagesize"; } elseif ( @$_GET[‘weizi‘] == 8 ) { _page(‘SELECT id FROM tb_picadvert WHERE weizi = 8‘,10); $_sql = "SELECT * FROM tb_picadvert WHERE weizi = 8 LIMIT $_pagenum,$_pagesize"; } elseif ( @$_GET[‘weizi‘] == 9 ) { _page(‘SELECT id FROM tb_picadvert WHERE weizi = 9‘,10); $_sql = "SELECT * FROM tb_picadvert WHERE weizi = 9 LIMIT $_pagenum,$_pagesize"; } elseif ( @$_GET[‘weizi‘] == 10 ) { _page(‘SELECT id FROM tb_picadvert WHERE weizi = 10‘,10); $_sql = "SELECT * FROM tb_picadvert WHERE weizi = 10 LIMIT $_pagenum,$_pagesize"; } elseif ( @$_GET[‘weizi‘] == 11 ) { _page(‘SELECT id FROM tb_picadvert WHERE weizi = 11‘,10); $_sql = "SELECT * FROM tb_picadvert WHERE weizi = 11 LIMIT $_pagenum,$_pagesize"; } $_result = _query($_sql); if ( isset($_GET[‘id‘]) && $_GET[‘action‘] = ‘delete‘ ) { $_sql1 = "DELETE FROM tb_picadvert WHERE id = ‘{$_GET[‘id‘]}‘"; _query($_sql1); if ( _affected_rows() == 1 ) { _close(); _alert_back(‘删除成功!‘); } else { _close(); _alert_back(‘删除失败!‘); } } ?> <!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=utf-8" /> <title>无标题文档</title> <style type="text/css"> <!-- body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; background-color: #F8F9FA; } --> </style> <link href="images/skin.css" rel="stylesheet" type="text/css" /> </head> <script> function test() { if(document.admin.weizi.value==‘‘) { alert(‘请选择位置‘); return false; } if(document.admin.picName.value==‘‘) { alert(‘请输入广告名称‘); return false; } } </script> <body> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="17" height="29" valign="top" background="images/mail_leftbg.gif"><img src="images/left-top-right.gif" width="17" height="29" /></td> <td valign="top" background="images/content-bg.gif"><table width="100%" height="31" border="0" cellpadding="0" cellspacing="0" class="left_topbg" id="table2"> <tr> <td height="31"><div class="titlebt">广告管理</div></td> </tr> </table></td> <td width="16" valign="top" background="images/mail_rightbg.gif"><img src="images/nav-right-bg.gif" width="16" height="29" /></td> </tr> <tr> <td height="71" valign="middle" background="images/mail_leftbg.gif"> </td> <td valign="top" bgcolor="#F7F8F9"><div> <!----> <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="10"><div style="font-size:12px;line-height:20px;">查看: <a href=‘picadvert.php‘>全部</a> <a href="?weizi=0">会员后台</a> | <a href="?weizi=1">网站首页轮播广告</a> | <a href="?weizi=2">点就赚首页轮播广告 </a> | <a href="?weizi=3">疯狂秒杀轮播广告</a>| <a href="?weizi=4">疯狂秒杀左下部广告</a>| <a href="?weizi=5">来就赚首页轮播广告</a>| <a href="?weizi=6">易币商城轮播广告</a>| <a href="?weizi=7">易币商城左下部广告</a>| <a href="?weizi=8">特惠区轮播广告</a>| <a href="?weizi=9">特惠区左下部广告</a>| <a href="?weizi=10">快捷导航</a>| <a href="?weizi=11">易得App首页轮播</a> <div style="border-right:50" align="center"> </div> </div> </td> </tr> <tr> <td><table width="100%" height="104" border:"solid 2px #CCC" cellpadding="0" cellspacing="0" class="nowtable"> <tr align="center" > <td bgcolor="#F2F2F2" class="left_txt2"> 用户ID</td> <td bgcolor="#F2F2F2" class="left_txt2"> 广告位置</td> <td width="15%" bgcolor="#F2F2F2" class="left_txt2" >广告名称</td> <td width="14%" bgcolor="#F2F2F2" class="left_txt2">连接地址</td> <td width="17%" bgcolor="#F2F2F2" class="left_txt2" >图片</td> <td bgcolor="#F2F2F2" class="left_txt2">状态</td> <td bgcolor="#F2F2F2" class="left_txt2" >操作</td> </tr> <form name="admin" id="admin" method="POST" action="?action=add" onsubmit="return test();"> <tr align="center" bgcolor="#F2F2F2" class="left_txt2"> <td width="15%" class="left_txt2" ></td> <td width="15%" class="left_txt2" > <select id="weizi" name="weizi" > <option value="">请选择广告位置</option> <option value="0">会员后台</option> <option value="1">网站首页轮播广告</option> <option value="2">点就赚首页轮播广告 </option> <option value="3">疯狂秒杀轮播广告</option> <option value="4">疯狂秒杀左下部广告</option> <option value="5">悬赏令左下部广告</option> <option value="6">易币商城轮播广告</option> <option value="7">易币商城左下部广告</option> <option value="8">特惠区轮播广告</option> <option value="9">特惠区左下部广告</option> <option value="10">快捷导航</option> </select></td> <td class="left_txt2"><input name="picName" type="text" id="picName" size="15" /></td> <td class="left_txt2"><input name="picImg" type="text" id="picImg" size="15" /></td> <td class="left_txt2"><input type="text" name="picLink" id="picLink" size="15" /> <input type="button" value="上传" onClick="window.open(‘../admin/upload.php?formname=admin&editname=adImage‘,‘‘,‘status=no,scrollbars=no,top=35,width=650,height=350‘)"/></td> <td width="9%" class="left_txt2"><select id="isFreeze" name="isFreeze"> <option value="1">显示</option> <option value="0">隐藏</option> </select></td> <td width="15%" class="left_txt2"><input type="submit" name="button" id="button" value="添加" /></td> </tr> </form> <?php $_row = _num_rows($_result); if ( $_row > 0 ) { while ( $_rows = _fetch_array($_result) ) { $_html = array(); $_html[‘id‘] = $_rows[‘id‘]; $_html[‘weizi‘] = $_rows[‘weizi‘]; $_html[‘picName‘] = $_rows[‘picName‘]; $_html[‘picImg‘] = $_rows[‘picImg‘]; $_html[‘picLink‘] = $_rows[‘picLink‘]; switch ( $_rows[‘userid‘] ) { case 0: $_html[‘userid‘] = ‘易得网发布‘; break; default: $_html[‘userid‘] = $_rows[‘userid‘]; } switch ( $_rows[‘weizi‘] ) { case 0: $_html[‘weizi‘] = ‘会员后台‘; break; case 1: $_html[‘weizi‘] = ‘网站首页轮播广告‘; break; case 2: $_html[‘weizi‘] = ‘点就赚首页轮播广告‘; break; case 3: $_html[‘weizi‘] = ‘疯狂秒杀轮播广告‘; break; case 4: $_html[‘weizi‘] = ‘疯狂秒杀左下部广告‘; break; case 5: $_html[‘weizi‘] = ‘来就赚首页轮播广告‘; break; case 6: $_html[‘weizi‘] = ‘易币商城轮播广告‘; break; case 7: $_html[‘weizi‘] = ‘易币商城左下部广告‘; break; case 8: $_html[‘weizi‘] = ‘特惠区轮播广告‘; break; case 9: $_html[‘weizi‘] = ‘特惠区左下部广告‘; break; case 10: $_html[‘weizi‘] = ‘快捷导航‘; break; case 11: $_html[‘weizi‘] = ‘易得网Android App首页轮播‘; break; } switch ( $_rows[‘isFreeze‘] ) { case 0: $_html[‘isFreeze‘] = ‘隐藏‘; break; case 1: $_html[‘isFreeze‘] = ‘显示‘; break; } $_html = _html($_html); ?> <tr class="left_txt2" align="center" > <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html[‘userid‘]?></td> <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html[‘weizi‘]?></td> <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html[‘picName‘]?></td> <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html[‘picImg‘]?></td> <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html[‘picLink‘]?></td> <td bgcolor="#F2F2F2" class="left_txt2"><?php echo $_html[‘isFreeze‘]?></td> <td width="15%" bgcolor="#F2F2F2" class="left_txt2"> <a href=‘?action=delete&id=<?php echo $_html[‘id‘]?>‘>删除</a> | <a href=‘picadvert_edit.php?id=<?php echo $_html[‘id‘]?>‘>修改</a></td> </tr> <?php } _free_result($_result); _close(); ?> <?php } else { echo "<tr><td colspan=‘7‘><div style=‘text-align:center;color:red;font-size:16px;‘>暂无广告位广告</div></td></tr>"; } ?> </table></td> </tr> </table> <?php _paging(2); ?> </div></td> <td background="images/mail_rightbg.gif"> </td> </tr> <tr> <td valign="middle" background="images/mail_leftbg.gif"><img src="images/buttom_left2.gif" width="17" height="17" /></td> <td height="17" valign="top" background="images/buttom_bgs.gif"><img src="images/buttom_bgs.gif" width="17" height="17" /></td> <td background="images/mail_rightbg.gif"><img src="images/buttom_right2.gif" width="16" height="17" /></td> </tr> </table> </body> </html>
三联动
/数据库mysql -- 数据库: `student` -- -- -------------------------------------------------------- -- -- 表的结构 `student` -- CREATE TABLE `student` ( `id` int(50) NOT NULL auto_increment, `name` varchar(50) collate utf8_unicode_ci NOT NULL, `dept` varchar(50) collate utf8_unicode_ci NOT NULL, `class` varchar(50) collate utf8_unicode_ci NOT NULL, `sex` varchar(50) collate utf8_unicode_ci NOT NULL, `dept_id` int(50) NOT NULL, `class_id` int(50) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=5 ; -- -- 导出表中的数据 `student` -- INSERT INTO `student` (`id`, `name`, `dept`, `class`, `sex`, `dept_id`, `class_id`) VALUES (1, ‘计算机名字‘, ‘计算机工程系‘, ‘计061‘, ‘男‘, 1, 11), (2, ‘教计名字‘, ‘计算机工程系‘, ‘教技061‘, ‘男‘, 1, 14), (3, ‘管理名字‘, ‘管理系‘, ‘管理061‘, ‘女‘, 2, 21), (4, ‘机械名字‘, ‘机械工程系‘, ‘自动化061‘, ‘男‘, 3, 31); ///以下是代码 <?php $link=mysql_connect("localhost","root","") or die("数据库服务器连接错误".mysql_error()); mysql_select_db("student",$link) or die("数据库访问错误".mysql_error()); mysql_query("set character set gb2312"); mysql_query("set names gb2312"); ?> <html> <head> <title>下拉框连动</title> </head> <body> <script language="JavaScript"> //二级菜单数组 var subcat = new Array(); <?php $i=0; $sql="select * from student"; $query=mysql_query($sql,$link); while($arr=mysql_fetch_array($query)) { echo "subcat[".$i++."] = new Array(‘".$arr["dept_id"]."‘,‘".$arr["class"]."‘,‘".$arr["class_id"]."‘);\n"; } ?> //三级菜单数组 var subcat2 = new Array(); <?php $i=0; $sql="select * from student"; $query=mysql_query($sql,$link); while($arr=mysql_fetch_array($query)) { echo "subcat2[".$i++."] = new Array(‘".$arr["class_id"]."‘,‘".$arr["class"]."‘,‘".$arr["name"]."‘);\n"; } ?> function changeselect1(locationid) { document.form1.s2.length = 0; document.form1.s2.options[0] = new Option(‘22请选择22‘,‘‘); for (i=0; i<subcat.length; i++) { if (subcat[i][0] == locationid) { document.form1.s2.options[document.form1.s2.length] = new Option(subcat[i][1], subcat[i][2]); } } } function changeselect2(locationid) { document.form1.s3.length = 0; document.form1.s3.options[0] = new Option(‘33请选择33‘,‘‘); for (i=0; i<subcat2.length; i++) { if (subcat2[i][0] == locationid) { document.form1.s3.options[document.form1.s3.length] = new Option(subcat2[i][2], subcat2[i][0]); } } } </script>三级联动演示:<BR> <form name="form1"> <select name="s1" onChange="changeselect1(this.value)"> <option>--请选择--</option> <option value=1>计算机工程系</option> <option value=2>管理系</option> <option value=3>机械工程系</option> </select> <select name="s2" onChange="changeselect2(this.value)"> <option>--请选择--</option> </select> <select name="s3"> <option>--请选择--</option> </select> </form> </body> </html>
垃圾
$list->select("select * from tb_user where realName like ‘%$realName%’"); <td width="32%" height="30" bgcolor="#f2f2f2" class="left_txt"><iframe src="uploadPicsp.php" frameborder="0" width="350" height="30"></iframe></td> 上传 echo "<span style=‘color:red‘>冻结</span>"; <td width="158"><?php echo date("Y-m-d h:i:s",$row["addtime"]);?></td> <?php switch ($row["tradingBao"]) { case "0": echo "不支持"; break; case "1": echo "支持"; break; } ?> <option value="0" <?php if($isFreeze==0) echo "selected";?>>冻结</option> <option value="1" <?php if($isFreeze==1) echo "selected";?>>解冻</option> if($regPwd!="") { $regPwd=($regPwd); $isok=$db->sql("update tb_user set regPwd=‘$regPwd‘ where id =$id"); if($isok==1) { } else { echo "<script>alert(‘修改失败‘);location.href=‘user.php‘</script>"; exit; } } $list->select("select * from tb_user where realName like ‘%$realName%’"); <td width="32%" height="30" bgcolor="#f2f2f2" class="left_txt"><iframe src="uploadPicsp.php" frameborder="0" width="350" height="30"></iframe></td> 上传 echo "<span style=‘color:red‘>冻结</span>"; <td width="158"><?php echo date("Y-m-d h:i:s",$row["addtime"]);?></td> <?php switch ($row["tradingBao"]) { case "0": echo "不支持"; break; case "1": echo "支持"; break; } ?> <option value="0" <?php if($isFreeze==0) echo "selected";?>>冻结</option> <option value="1" <?php if($isFreeze==1) echo "selected";?>>解冻</option> if($regPwd!="") { $regPwd=($regPwd); $isok=$db->sql("update tb_user set regPwd=‘$regPwd‘ where id =$id"); if($isok==1) { } else { echo "<script>alert(‘修改失败‘);location.href=‘user.php‘</script>"; exit; } }
笔记
echo ,print_常用的输出方式有:echo、print、print_r、var_dump、var_exprot等;echo和print常用来输出字符串;查看数组常用print_r、var_dump、var_exprot;r() <?php include("conn/conn.php"); if(trim($_POST[username])!= "" and trim($_POST[password])!= "" and trim($_POST[tel])!=""){ $pwd = md5($_POST[password]); $sql = "insert into tb_user(username,password,address,explains)values(‘".$_POST[username]."‘,‘".$pwd."‘,‘".$_POST[address]."‘,‘".$_POST[tel]."‘)"; $result = mysql_query($sql,$conn); if($result){ echo "<font color=‘red‘>注册成功。</font>"; }else{ echo "<font color=‘green‘>注册失败!</font>"; } }else{ echo "请认真填写用户名和密码!"; } ?>
标签:des android style blog http color io os ar
原文地址:http://www.cnblogs.com/qiuyang1/p/4002294.html