php数据库查询查询结果 PHP查询数据库

php怎么获取数据库查询返回的结果

从查询结果取值,需要遍历结果集!示例如下:

我们提供的服务有:成都网站建设、网站建设、微信公众号开发、网站优化、网站认证、恩施土家ssl等。为1000多家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的恩施土家网站制作公司

$rs = mysql_query("select * from www_liu where xx='$xx' and yy='$yy'");

echo "查询信息如下:br/";

while($row = mysql_fetch_array($rs))

{

echo $row['字段2'] . "=====" . $row['字段三'];

echo "br /";

}

//关闭数据库连接

//mysql_close();

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如何查询数据并显示结果。

这个简单啊!

首页做个前台输入姓名和会员卡信息的页面,我做个简单的页面给你看

!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文件在浏览器中打开,查看查询到数据库中的内容的结果。


文章名称:php数据库查询查询结果 PHP查询数据库
当前地址:http://myzitong.com/article/hhsdos.html