php数据库从表单查询 php提交表单数据到数据库

php用表单形式显示数据库信息后怎样进行增删改查,提交到数据库先select查询,返回的结果显示到表单中 。
在update操作 , 将在表单中修改的结果更新到数据库中 。
很容易的 , 用thinkphp做更容易 。
我要用户PHP和数据库做一个成绩查询系统 。请问我应该怎么做?。坎灰丛?/h2>设计思路么?
首先你需要设计数据库,成绩查询需要设计哪些表,最简单的就是这几三张表:学生表,课程表,成绩表,然后设计每个表的字段和关联关系
然后写代码,对数据库进行CURD,这种小系统完全不用考虑架构,数据量等,所以很简单的,数据库+PHP服务端+web前端 最多1天就差不多能做好了
用PHP代码如何查询数据库表中的一条记录php数据库从表单查询我直接在这给php数据库从表单查询你修改答案算php数据库从表单查询了
使用的时候删除行号 修改数据库配置 如果想使用 页面不刷新查询数据库 需要使用JQUERY 如果有需要给php数据库从表单查询我留言
1 ?php
2if(isset($_POST['submit'])$_POST['submit']=='提交'){
3//判断是否是提交过来的
4$intext = $_POST['intext'];
5if($intext!=null||$intext!=''){
6$link = mysql_connect("localhost", "root", "123456");
7//数据库配置信息 第一个参数数据库位置第二个是用户名第三个是密码
8mysql_select_db("szn_test");
9//设置要使用的数据库
10$sql = "select * from demo where res = '".$intext."'";
11//SQL语句
12var_dump($sql);
13$res = mysql_query($sql);
14$arr = array();
15//吧结果存入数组 并记录数组长度
16$count = 0;
17while($data = https://www.04ip.com/post/mysql_fetch_array($res)){
18$arr[$count] = $data;
19$count++;
20}
21//关闭数据库
22mysql_close($link);
23}
24}
25
26 ?
27 html
28 head
29title/title
30 /head
31 body
32 form id="form1" method="post" action="demo.php"
33input type="text" name="intext"
34input type="submit" name="submit" value="https://www.04ip.com/post/提交"
35 /form
36 ?php
37if(isset($arr)$arr != null){
38for($i = 0; $i$count; $i++){
39foreach($arr[$i] as $key = $value){
40echo "key:".$key." value:".$value;
41echo "";
42}
43echo "br";
44}
45}
46 ?
47 /body
48 /html
这个是数据库查询代码 你可以看以下对照着修改修改
php如何查询数据库表中的数据并显示这个简单啊php数据库从表单查询!
首页做个前台输入姓名和会员卡信息的页面,我做个简单的页面给你看
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
html xmlns="
head
meta http-equiv="Content-Type" content="text/html; charset=utf-8" /
title会员查询系统/title
/head
body
form id="form1" name="form1" method="post" action="test.php"
p
label for="name"/label
input type="text" name="name" id="name" /
/p
p
label for="vipid"/label
input type="text" name="vipid" id="vipid" /
/p
p
input type="submit" name="button" id="button" value="https://www.04ip.com/post/查询" /
/p
/form
/body
/html
然后我给你一个test.php的文件代码php数据库从表单查询:
?php
$name=trim($_POST['name']);
$vipid=trim($_POST['vipid']);
$con = mysql_connect("127.0.0.1","数据库用户名","数据库密码");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$a=mysql_select_db("数据库名字", $con);
$sql="select * from kh_customer where name = '$name' and vipid = '$vipid'";

推荐阅读