1.php查询数据 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="查询" /

/p

/form

/body

/html

然后我给你一个test.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'";

$result = mysql_query($sql);

while($row = mysql_fetch_array($result))

{

echo $row['name'] . " " . $row['data'];

echo "br /";

}

mysql_close($con);

?

页面美化自己去搞!只能帮你这么多了

PHP用户登陆页面查询数据库

首先登陆要用用户名,密码等等信息,这些都要存在数据库中,这样才能用户登陆时验证是否能够登陆,

1.创建一个数据库,建表例表一(用户名,密码)等等。。

1.设计页面代码包含连接数据库,数据库操作代码等等(加入用户,删除用户。。)

2.代码中包含用户登陆输入

用户名,密码

3.打开数据库表,查找是否有该用户名,如果存在,密码是否正确,不正确byebye

(请看java书本

数据库内容,包含建立数据库,添加删除基本操作)

用PHP代码如何查询数据库表中的一条记录

你的意思是说

点击查询后

要吧与关键字相关联的整条记录都显示出来?

那样的话

你要先把这条记录复制

给某个数组,然后输出这个数组就可以了

$sql="select

*

from

db1

where

name=$_post[name]";

$result=mysql_query($sql,$con);

$row=mysql_fetch_array($result)

echo

$row[name];

echo

$row[age];

……

PHP的查询代码

1.php代码  a.php?t=1

//a.php  t是列表type

$type =$_GET['t'];

if($type==='1')

{

$where_sql = "where lxtc like '乐享%'";    

}else if($type==='2')

{

$where_sql = "where lxtc like '新融合%'";  

}elseif($type==='3'){

$where_sql = "where lxtc like '新融合%' OR lxtc like '乐享%'";

}else{

$where_sql =' where 1';//所有的

}

$sql = "select * from `table` ".$where_sql;

$num_sql = "select count(*)as num from `table`".$where_sql;

//获取统计总数

//$db是mysql对象 其实就是查询两条sql语句的对象 简写如下

$db-query($num_sql);

//列表

$row= $db-query($sql);

//循环$row就是结果

单单数据逻辑不麻烦,难点应该是sql语句的书写。用到like   %  第二用到OR连接,

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="查询" /

/p

/form

/body

/html

然后我给你一个test.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'";

$result = mysql_query($sql);

while($row = mysql_fetch_array($result))

{

echo $row['name'] . " " . $row['data'];

echo "br /";

}

mysql_close($con);

?

页面美化自己去搞!只能帮你这么多了

PHP查询MYSQL的内容,并输出结果

1、用navicat新建一个数据库database1。

2、在database1数据库中新建一个表table2。

3、在table2中添加新的数据,新建一个名称为mysql_query的数据库。

4、在页面中用mysql_connect 函数与数据库建立连接。

5、用mysql_select_db函数选择要查询的数据库。

6、添加一个查询 table2表的查询语句“$sql=select * from table2“。

7、将查询语句$sql添加到查询数据库函数mysql_query中,返回值赋值给变量query。

8、最后将mysql_query。php文件在浏览器中打开,查看查询到数据库中的内容的结果。


本文标题:1.php查询数据 PHP数据
网站URL:http://myzitong.com/article/docphij.html