-1
我是php
的初学者,我编写了一个可点击的搜索结果函数。我的问题是如何点击一个特定的搜索项目,可以点击并打开另一个页面的全部细节。下面我为searresults.php
页面或目标网页客户端后,点击代码一个搜索项:将我的php搜索结果链接到另一页
<!-- language: lang-html -->
<!DOCTYPE HTML>
<html>
<head>
<title>Search Results</title>
</head>
<body>
<h3>Search Results</h3>
<?php
$con = mysqli_connect("localhost","root","","1");
$excursion_id = $_GET['excursion_id'];
$sql = "select * from excursionitem where excursion_id = '$excursion_id'";
$result = mysqli_query($con,$sql);
while($row = mysqli_fetch_array($result))
{
$Item_Name = $row['Item_Name'];
$Description = $row['Description'];
$Price = $row['Price'];
$excursion_id = $row['excursion_id'];
echo '$excursion_id' ;
}
?>
</body>
</html>
从你身边的任何帮助,将不胜感激。
您是大开[SQL注入(http://php.net/manual/en/security.database.sql-injection.php),并应真正使用[预处理语句(HTTP:// PHP。 net/manual/en/mysqli.quickstart.prepared-statements.php)而不是串联你的查询。特别是因为你没有逃避用户输入! –
除此之外,我似乎并没有清楚地理解_“如何点击一个特定的搜索项目,可以点击并在另一个页面打开全部细节”_。你能解释得更好吗? –
我的意思是,当客户端搜索我的(旅游)数据库的结果将出现在简短的..但是当他在一个项目点击(例如)他应该被重定向到携带所有这个项目的全部细节 –