使用php,mysql获取搜索结果的更多信息

时间:2015-05-20 11:43:06

标签: php mysql

我有表格。当在表单中选择选项并单击搜索按钮时,它会根据给定的值在数据库中搜索。这里我得到的是用户的结果限制值。但是,如果有人想要查看该特定用户的更多详细信息,我将添加点击此处链接以从数据库中获取该特定用户的更多详细信息。我怎样才能实现这一点。

<?php
include('config.php');
include('header.php');
if(isset($_POST['search'])){
$category = $_POST['category'];
$State = $_POST['State'];
$city = $_POST['city'];
$sql = "SELECT user,category,State,city FROM userdetails Where userdetails.category = '$category' OR userdetails.State = '$State' AND userdetails.city = '$city'";
$records = mysql_query($sql);
}
?>
<html>
<body>
<table width= "800" border="2" cellpadding="1" cellspacing="1">
<legend>Search Screen</legend>
while ($userdetails=mysql_fetch_assoc($records)) {
echo "<div class='controls'><tr>";
echo "<p><label class='control-label' for='searchall'>Name:     </label>".$userdetails['user']."</p>";
echo "<p><label class='control-label' for='searchall'>Category:</label>".$userdetails['category']."</p>";
echo "<p><label class='control-label' for='searchall'>State:</label>".$userdetails['State']."</p>";
echo "<p><label class='control-label' for='searchall'>City:</label>".$userdetails['city']."</p>";
echo "<P><a href='userfullinfo.php'>More Info</a></p>";
echo "</tr></div>-------------------------------------------";
}
?>
</table>
</body>
</html>

如何在点击更多信息时获得该特定用户的更多列值。

提前致谢

0 个答案:

没有答案