当我加载它时会出现这个错误:注意:尝试在第29行的/public_html/php/application/views/admin/index.php中获取非对象的属性,并表示它不活动时很活跃。
请帮忙
<div class="content">
<?php
$con = mysql_connect("","","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("", $con);
$result = mysql_query("SELECT * FROM users ORDER by user_id");
echo "<link rel='stylesheet' href='<?php echo URL; ?>public/css/style.css' /><div class='CSSTableGenerator' >
<table >
<tr>
<td>ID</td>
<td >Username</td>
<td>User Active</td>
</tr>";
while($row = mysql_fetch_array($result))
{
if ($row->user_active == "1")
{
$mark = 'Yes';
}
else
{
$mark = 'No';
}
echo "<tr>";
echo "<td>" . $row['user_id'] . "</td>";
echo "<td>" . $row['user_name'] . "</td>";
echo "<td>" . $mark . "</td>";
echo "</tr>";
}
echo "</table></div>";
mysql_close($con);
?>
</div>
谢谢josh_24_2
答案 0 :(得分:1)
while($row = mysql_fetch_array($result))
{
if ($row['user_active'] == "1")
{
$mark = 'Yes';
}
else
{
$mark = 'No';
}
echo "<tr>";
echo "<td>{$row['user_id']}</td>";
echo "<td>{$row['user_name']}</td>";
echo "<td>{$mark}</td>";
echo "</tr>";
}
echo "</table></div>";