我有一个数据库,其中包含一个表中的公司的详细信息。我也有PHP代码,我可以在其中显示搜索到的查询数据从数据库。一切正常,问题是我想显示所有搜索到的查询数据在他们各自的页面中,再次重复我想在动态页面中显示查询结果(该页面单独负责搜索的查询)。
php和html代码
<body>
<div class="heading">
<div class="logotext">
<p style="margin:0px"><a href="../index.php" style="color:black">Clore</a></p>
</div>
<div class="searchbox">
<div class="SearchBar">
<form action="search.php" method="GET">
<input style="box-shadow: 0 2px 2px rgba(0,0,0,0.19), 0 2px 5px rgba(0,0,0,0.23); " list="myCompanies" id="suggest" type="text" name="q" placeholder="Start typing keywords...." autocomplete="off"><datalist id="myCompanies">
</datalist>
<div class="SearchBut">
<input style="box-shadow: 0 2px 2px rgba(0,0,0,0.19), 0 2px 5px rgba(0,0,0,0.23); " type="submit" value="Search">
</div>
</form>
</div>
</div>
</div>
<div>
<?php
$conn = mysqli_connect("mysql.hostinger.in","u402378368_clore","clore.cf","u402313368_clore") or die("could not search");
$set=$_GET['q'];
if($set){
$show=("SELECT * FROM table1 where name LIKE '%$set%' OR about LIKE '%$set%' OR founder LIKE '%$set%' OR ceo LIKE '%$set%' OR headquaters LIKE '%$set%' OR established LIKE '%$set%' ") or die("could not search");
$result = mysqli_query($conn,$show);
$num_rows = mysqli_num_rows($result);?>
<div class="nrezdez"><?php
if($num_rows == 0){
echo "No Results Found For * ".$set." * "."<br>";
}
else if($num_rows ==1){
echo "Found ".$num_rows." Result <br>";
echo "Showing Result For * ".$set." *"."<br>";
}
else if($num_rows > 1){
echo "Found ".$num_rows." Results <br>";
echo "Showing Results For * ".$set." *"."<br>";
}
?></div><?php
while($rows = mysqli_fetch_array($result)){
?>
<div class="redez"><?php
echo "<strong>Name: </strong><a href=".$rows['link'].">".$rows['name']."</a>"."<br> <br>";
echo "<strong>About: </strong>".$rows['about']."<br>";
echo "<strong>Founder: </strong>".$rows['founder']."<br>";
echo "<strong>CEO: </strong>".$rows['ceo']."<br>";
echo "<strong>Revenue: </strong>".$rows['revenue']."<br>";
echo "<strong>Headquaters: </strong>".$rows['headquaters']."<br>";
echo "<strong>Estd: </strong>".$rows['established']."<br>";
?>
</div>
<?php
}
}
?>
</div>
</body>
请帮助我如何在各自的页面中显示结果。 为什么我需要这个帮助因为,谷歌将索引网页,但在我的情况下,我在一个页面中显示数据,其中我的网站将不会被谷歌索引,但如果我在他们各自的页面显示搜索查询的数据谷歌将索引我的页面。 谢谢