各位大哥帮忙啊,连接的是postgresql数据库,比如有表名为:table ,里面有字段:ID,card,name
现在从表单中输入card的值,然后在table中查找card的值并输出该行,
各位大哥该怎么弄??
现在从表单中输入card的值,然后在table中查找card的值并输出该行,
各位大哥该怎么弄??
解决方案 »
- 关于paypal的问题,请教各位
- PHP 复选框数据的循环写入问题 请大侠帮忙!急..........................
- 新配的php环境,运行个文件出现错误,望解答!!(菜鸟提问)
- $str="abcd"如何变成"acbd"?
- dirname(__FILE__)."/../" 这个指的意思就是当前文件的上一级文件夹路径吧?
- 高分求购物系统的数据库结构
- 如何让从库中取出的文章,自动换行!谢谢!
- asp中的instr()在php中如何实现?
- 有谁在用phpmyadmin的,以发一个给我好吗
- php的面向对象有没有用
- php 站内搜索怎么实现,有哪些好的方法?
- url存入mysql数据库前的时候要进行什么处理?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<form action="2.php" method="post">
<input type="text" name="card" id="card"/>
<input type="submit" name="submit" >
</form>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
2.php<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<div align="center">
<table border="2">
<tr>
<td>ID</td>
<td>card</td>
<td>name</td>
</tr>
<?php
$card=$_POST["card"];
$host="localhost";//数据库地址
$user="root";//连接用户名
$pwd="";//密码
$base="";//数据库名称
@$con=mysql_connect($host,$user,$pwd) or die("连接失败");
@mysql_select_db($base) or die("数据库名称出错"); $sql="select * from table where card='".$card."'";
$i=0;
while($row = mysql_fetch_array($result)){ ?>
<tr> <?php while($i<3){?>
<td><?php echo $row[$i];?></td><?php $i++;
}
}?>
</tr>
</table>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<form action="2.php" method="post">
<input type="text" name="card" id="card"/>
<input type="submit" name="submit" >
</form>
</body>
</html>