PHP数据库查询并显示 php实现数据库查询

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="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'";
$result = mysql_query($sql);
while($row = mysql_fetch_array($result))
{
echo $row['name'] . " " . $row['data'];
echo "br /";
}
mysql_close($con);
?
页面美化自己去搞!只能帮你这么多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
$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 /";
}
【PHP数据库查询并显示 php实现数据库查询】mysql_close($con);
?
页面美化自己去搞!只能帮你这么多了
如何用php获取数据库信息并显示获取ppq数据库的所有表名的代码:
?php
$server='localhost';
$user='root';
$pass='12345';
$dbname='ppq';
$conn=mysql_connect($server,$user,$pass);
if(!$conn)
die("数据库系统连接失败!");
$result=mysql_list_tables($dbname);
if(!$result)
die("数据库连接失败!");
while($row=mysql_fetch_row($result))
{
echo
$row[0]."
";
}
mysql_free_result($result);
?
mysql_list_tables
(PHP
3,
PHP
4
,
PHP
5)
mysql_list_tables
--
列出
MySQL
数据库中的表
说明
resource
mysql_list_tables
(
string
database
[,

推荐阅读