成都创新互联网站制作重庆分公司

php检查数据,php输出mysql查询结果

php如何查询数据库表中的数据并显示

这个简单啊!

创新互联建站-专业网站定制、快速模板网站建设、高性价比永年网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式永年网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖永年地区。费用合理售后完善,十年实体公司更值得信赖。

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

!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怎么判断数据类型

is_array — 检测变量是否是数组

is_bool — 检测变量是否是布尔型

is_callable — 检测参数是否为合法的可调用结构

is_double — is_float 的别名

is_float — 检测变量是否是浮点型

is_int — 检测变量是否是整数

is_integer — is_int 的别名

is_iterable — Verify that the contents of a variable is an iterable value

is_long — is_int 的别名

is_null — 检测变量是否为 NULL

is_numeric — 检测变量是否为数字或数字字符串

is_object — 检测变量是否是一个对象

is_real — is_float 的别名

is_resource — 检测变量是否为资源类型

is_scalar — 检测变量是否是一个标量

is_string — 检测变量是否是字符串

用PHP代码如何查询数据库表中的一条记录

你的意思是说

点击查询后

要吧与关键字相关联的整条记录都显示出来?

那样的话

你要先把这条记录复制

给某个数组,然后输出这个数组就可以了

$sql="select

*

from

db1

where

name=$_post[name]";

$result=mysql_query($sql,$con);

$row=mysql_fetch_array($result)

echo

$row[name];

echo

$row[age];

……

php中检查一个数据在不在一个数组中

array_key_exists 函数可以检查key在不在数组中

array_key_exists($id, $arr)

返回true标识key存在,否则返回false

注意多看PHP手册,Array Functions章节写的很清楚


当前标题:php检查数据,php输出mysql查询结果
分享URL:http://cxhlcq.com/article/hccoej.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部