
正文
php中显示数据表 php显示mysql中的数据
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
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中显示数据表!只能帮你这么多php中显示数据表了
相关问答
Q1: PHP文件在网页里显示部分php代码(想显示数据库表里面的数据)
因为你少写了一个大括号的结尾。
修改后:
table id="DataList1" cellspacing="0" border="0" width="100%"
?php
$db = mysqli_connect('localhost', 'root','root');//连接MySQL服务器
mysqli_select_db($db,'ticket');//选择数据库文件
if(mysqli_connect_errno()){
echo "Error:Could not connect to mysql ticket"; exit;
}
$q="select * from news";//设置查询指令
$result=mysql_query($db,$q);//执行查询
while($row=mysql_fetch_assoc($result)) //将result结果集中查询结果取出一条
{
echo"trtd".$row["news"]."/tdtd".$row["date"]."/td/tr"; exit;
}
} // 就是这样?
?
/table
谢谢谢谢谢谢码密。的入输要需所面。界理管台后器。由路陆登是。码密理管。廖仲庭。器由。路。
Q2: php怎么把数据库中的数据显示成表格
用table/table就可以了啊php中显示数据表,然后用PHPphp中显示数据表的逐条输出数据语句相结合,php中显示数据表你图太小,根本看不清,不过道理就是这么个道理的
Q3: 怎么用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显示mysql中的数据的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。







