使用PDO显示表外的PHP查询

使用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循环

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";
        }

    }