最基本的接收和读取和数据库命令增删改查
2016-09-06 16:22
357 查看
sampleindex.php
读取register01.php
增删等
测试数据,快速添加几十万的数据。
查看总共几条数据
<html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <h1>用户注册</h1> <form action="register01.php" method="post"> <table border='1'><tr><td> 用户名:</td> <td><input type="text" name="username"/></td></tr> <tr><td> 密码:</td> <td><input type="password" name="password"/></td></tr> <tr><td colspan="2">性别:<input type="radio" name="sex" value="female" />女 <input type="radio" name="sex" value="male" />男 </td></tr> <tr><td> 你有什么兴趣爱好:</td><td> <input type="checkbox" name="hobby[]" value="唱歌" />唱歌<br /> <input type="checkbox" name="hobby[]" value="跳舞" />跳舞<br /> <input type="checkbox" name="hobby[]" value="游泳" />游泳<br /> <input type="checkbox" name="hobby[]" value="骑马" />骑马<br /> <input type="checkbox" name="hobby[]" value="射箭" />射箭<br /> </td></tr> <tr><td>你的所在地是:</td><td><select name="city"> <option value="beijing">北京</option> <option value="tianjin">天津</option> <option value="shanghai">上海</option> <option value="ningbo">宁波</option> </select></td></tr> <tr><td colspan="2"><textarea rows="10" name="intro" cols="33"></textarea></td></tr> <tr><td> & 4000 lt;input type="submit" value="用户注册" /></td> <td> <input type="reset" value="重新填写" /></td></tr> </table> </form> </html>
读取register01.php
<?php echo "<pre>"; echo print_r($_POST); echo "</pre>"; //以上是全部的数据了 //下面是特定的读取 $name=$_POST['username']; $pwd=$_POST['password']; $xinbgie=$_POST['sex']; //接收数组checkbox $hobbies=$_POST['hobby']; $intro=$_POST['intro']; $city=$_POST['city']; echo "个人信息如下:<br/>"; echo "用户名是:$name "; echo "性别是:$xinbgie "; echo "密码是:$pwd <br/>"; echo "此人的爱好有:<br/>"; for($i=0;$i<count($hobbies);$i++){ echo "$hobbies[$i] <br/>"; } echo "个人信息介绍如下:<br/>"; echo "我来自:$city<br/>$intro<br/>"; ?>
增删等
create table empAdminTable( id int primary key, name varchar(32) not null, password varchar(128) not null ); create table empTable( id int primary key auto_increment, name varchar(64) not null, grade tinyint, email varchar(64) not null, salary float ); //添加初始化数据 insert into empAdminTable(id,name,password) values (100,'admin',md5('admin123')); insert into empTable(name,grade,email,salary) values ('zhangsan',1,'zhangsan@163.com',250); insert into empTable(name,grade,email,salary) values ('lisi01',1,'lisi01@sohu.com',250); insert into empTable(name,grade,email,salary) values ('lisi02',1,'lisi02@sohu.com',300); insert into empTable(name,grade,email,salary) values ('lisi03',1,'lisi03@163.com',450); insert into empTable(name,grade,email,salary) values ('lisi04',1,'lisi04@163.com',237); insert into empTable(name,grade,email,salary) values ('lisi05',1,'lisi@sohu.com',200);
测试数据,快速添加几十万的数据。
insert into empTable(name,grade,email,salary) select name,grade,email,salary from empTable;
查看总共几条数据
select count(*) from empTable;
相关文章推荐
- oracle系统包--dbms_output的用法
- 为什么选择图形数据库,为什么选择Neo4j?
- vsize的用法
- Asp.net Core 使用Redis存储Session
- MySQL索引使用方法和性能优化
- PL/SQL学习(二)条件和循环语句
- sqlserver中distinct的用法(不重复的记录)
- 为什么选择图形数据库,为什么选择Neo4j?
- mysql 按日期分组
- sql中,or与and 的运算级别
- SQLite 数据库的基本结构
- 数据库查询经验总结,不定期更新
- oracle 使用netca报错
- INNODB 关键特性
- PLSQL 链接 Oracle
- 简单分析tkprof输出文件的内容
- 用mysqlslap对MySQL进行压力测试
- mysql 安装
- MySQL日志——Undo | Redo
- M202: MongoDB Advanced Deployment and Operations - Chapter 5: Log Files