这个简单啊!
首页做个前台输入姓名和会员卡信息的页面,我做个简单的页面给你看
<!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)
?>
页面美化自己去搞!只能帮你这么多了
<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 "<tr><td>ID</td><td>姓名</td><td>邮箱</td><td>电话</td><td>地址</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>
$mysqli = new mysqli ( DB_HOST , DB_USER , DB_PASSWORD , DB_NAME )/* check connection */
if ( mysqli_connect_errno ()) {
printf ( "Connect failed: %s\n" , mysqli_connect_error ())
exit()
}
$limit = 10
$query = "SELECT * FROM sheet1 LIMIT ".$limit
$result = $mysqli -> query ( $query )
/* associative array */
while($row = $result -> fetch_array ( MYSQLI_ASSOC )){
echo $row['A'] . "\t"
echo $row['B'] . "\t"
echo $row['C'] . "\t"
echo $row['D'] . "\t"
echo $row['E'] . "\t"
echo $row['F'] . PHP_EOL
}
/* free result set */
$result -> free ()
/* close connection */
$mysqli -> close ()
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)