我需要過濾一個會話表,通常這是我如何顯示錶列表。PHP搜索,只顯示會話ID日誌
<?php
$con=mysqli_connect("localhost","root","","esc");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM sponsor ;");
echo "<table border='1'>
<tr>
<th>ID</th>
<th>PIN</th>
<th>Author</th>
<th>Author ID</th>
<th>Entry Date</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['sid'] . "</td>";
echo "<td>" . $row['spin'] . "</td>";
echo "<td>" . $row['spuname'] . "</td>";
echo "<td>" . $row['suid'] . "</td>";
echo "<td>" . $row['sdate'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
我想知道是否有可能在這部分...
$result = mysqli_query($con,"SELECT * FROM sponsor ;");
添加Where spuname = 'spuname'
我想我這樣做是錯誤的方式。
我想要做的是顯示過濾的表,因此具有該會話的人將只能看到他的日誌。
spuname?因此,您可以將它傳遞給查詢 – Chitowns24
'spuname'存儲@ sponsor表,它是成員輸入數據的表。 @ Chitowns24 – PHPNewbie
'SELECT * FROM sponsor where spuname ='spuname'' ...就像你說的那樣。 –