<?php
$con=mysqli_connect("","","","");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM itiraf");
$result2 = mysqli_query($con,"SELECT oy FROM users WHERE username='". $Account->session('display_name') ."'");
if(mysqli_num_rows($result)=="0"){echo "Henüz itiraf yapılmamış";}
else{
echo "<table border='1' class='imagetable'>
<tr>
<th>NO:</th>
<th>İsim</th>
<th>İtiraf</th>
<th>Oy</th>
<th>Oy Kullan</th>
</tr>";
while($row = mysqli_fetch_array($result)){
echo "<tr>";
echo "<td><b>" . $row['id'] . "</b></td>";
echo "<td><b>" . $row['username'] . "</b></td>";
echo "<td><b>" . $row['itiraf'] . "</b><br></td>";
echo "<td><b>" . $row['oy'] . "</b><br></th>";
while($row2 = mysqli_fetch_array($result2)){
if ($row2['oy'] ==10) { echo "<td>Oy kullandınız</td>";}
else{echo "<td><a href='oy.php?id={$row[id]}'><img src='assets/images/up.png'/></a></td>";}}
echo "</tr>";
echo "</form>";}
echo "</table>"; }
mysqli_close($con);?>
第一次工作。第二,雖然工作,但不是很好。只有一次,我可以看到豎起大拇指的形象。我在這裏添加了關於表格的所有代碼。任何想法?雖然裏面有2個結果
請格式化您的代碼 – Typoheads
^+1,將很高興知道你想達到什麼,以及有什麼問題。 –
在打印「無法連接到MySQL」(與嘗試在下一行執行查詢)之後,您會發現停止執行或者有不同的控制流來處理場景很有用。 – faintsignal