php选择表显示表内数据 php获取表格数据

php 选取数据表中的指定一行的部分信息,显示在网页上

?php

创新互联专注于古浪企业网站建设,响应式网站开发,成都商城网站开发。古浪网站建设公司,为古浪等地区提供建站服务。全流程按需定制,专业设计,全程项目跟踪,创新互联专业和态度为您提供的服务

header("Content-Type:text/html;charset=utf-8");

mysql_connect ('localhost', 'kiko', '123456')or die("不能连接数据库");

//$res = mysql_db_query("user","select O2,PH,TP,NH3,DT from user_pool");

$res=mysql_db_query("user","select o2,PH,TP,NH3,DT from user_pool where us='qwe');

while ($row = mysql_fetch_array($res)) {

?

trtd检测时间/tdtd? echo $row["DT"];?/td /tr    

trtd温度(单位:)/tdtd? echo $row["TP"];?/td /tr    

trtd酸碱度/tdtd? echo $row["PH"];?/td 

trtd含氧量(单位:mg/L) /tdtd? echo $row["O2"];?/td /tr    

trtd含氨量(单位:mg/L)/tdtd? echo $row["NH3"];?/td/tr

?

}

mysql_free_result($res);

?

/table

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 数据表数据

html

head

title浏览表中记录/title

/head

body

center

?php

$db_host=localhost; //MYSQL服务器名

$db_user=root; //MYSQL用户名

$db_pass=""; //MYSQL用户对应密码

$db_name="test"; //要操作的数据库

//使用mysql_connect()函数对服务器进行连接,如果出错返回相应信息

$link=mysql_connect($db_host,$db_user,$db_pass)or die("不能连接到服务器".mysql_error());

mysql_select_db($db_name,$link); //选择相应的数据库,这里选择test库

$sql="select * from test1"; //先执行SQL语句显示所有记录以与插入后相比较

$result=mysql_query($sql,$link); //使用mysql_query()发送SQL请求

echo "当前表中的记录有:";

echo "table border=1"; //使用表格格式化数据

echo "trtdID/tdtd姓名/tdtd邮箱/tdtd电话/tdtd地址/td/tr";

while($row=mysql_fetch_array($result)) //遍历SQL语句执行结果把值赋给数组

{

echo "tr";

echo "td".$row[id]."/td"; //显示ID

echo "td".$row[name]." /td"; //显示姓名

echo "td".$row[mail]." /td"; //显示邮箱

echo "td".$row[phone]." /td"; //显示电话

echo "td".$row[address]." /td"; //显示地址

echo "/tr";

}

echo "/table";

?

/center

/body

/html


当前标题:php选择表显示表内数据 php获取表格数据
URL网址:http://lszwz.com/article/dojccei.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款