使用PDO显示表外的PHP查询
所以我有一个foreach循环使用PDO显示表外的PHP查询,php,Php,所以我有一个foreach循环 foreach ($stmt as $row) { echo "<tr>"; echo "<td>".$row['user_name']."</td>"; echo "<td>".$all_users->getUserStatus($row['Enabled'])."</td>"; echo "<td>".$row[
foreach ($stmt as $row)
{
echo "<tr>";
echo "<td>".$row['user_name']."</td>";
echo "<td>".$all_users->getUserStatus($row['Enabled'])."</td>";
echo "<td>".$row['last_login']."</td>";
echo "<td>"."<button type='button' class='btn btn-text-color'>"."Show"."</button>"." "."<button type='button' class='btn btn-text-color'>"."Edit"."</button>"."</td>";
echo "<td>"."<input type='checkbox' name='selectAll'>"."</td>";
echo "</tr>";
}
echo "</table>";
帮助我,因为我是PHP的新手 在
getUserStatus()中使用return
而不是echo
在getUserStatus()
工作!!非常感谢。工作顺利!!非常感谢。
echo "<td>".$all_users->getUserStatus($row['Enabled'])."</td>";
function getUserStatus($userStatus)
{
if($userStatus == 0)
{
echo "No";
}
else if ($userStatus == 5)
{
echo "Yes";
}
}
function getUserStatus($userStatus)
{
if($userStatus == 0)
{
return "No";
}
else if ($userStatus == 5)
{
return "Yes";
}
}