http url www.tlss.edu.pk/result.php?r=1
如果
Sr_=1
我的SQL查询是
<?php
include 'form.html';
$r1=$_GET["r"];
$n1=$_GET["n"];
// Create connection
$con=mysqli_connect("localhost","chumspai_tlss","Tls121","chumspai_tlsResult");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
echo $n1;
$result = mysqli_query($con,"SELECT * FROM nursery_blue_ WHERE students_names like '%$n1%'");
while($row = mysqli_fetch_array($result))
{
echo '<pre>';
print_r ($row['sr_']. '.'. $row['students_names']);
echo '</pre>';
}
?>
答案 0 :(得分:0)
可能需要尝试
while($row = mysqli_fetch_array($result))
{
//print_r ($row['sr_']. '.'. $row['students_names']);
if($row['sr_'] == 1) {
echo "<a href='www.tlss.edu.pk/result.php?r=".$row['sr_']."'>"
.$row['students_names']."</a>";
}
}
如果您想要所有结果,则可以在此处删除if
条件。
答案 1 :(得分:0)
在你的循环中添加一个链接,如果你有任何条件为show link添加条件
while($row = mysqli_fetch_array($result)) {
echo "<a href='http://www.tlss.edu.pk/result.php?r=".$row['sr_']."'>".$row['students_names']."</a>";
}