I'm trying to change the output of a variable from 0 to display user or from 1 to display superuser,
<?php
$result = mysql_query("SELECT * FROM users ") or trigger_error(mysql_error());
$tv = nl2br($row['type']);
if ($tv == '0') {
$tv = 'user';
} elseif ($tv == '3') {
$tv = 'superuser';
} else {
$tv = 'N/A';
}
while($row = mysql_fetch_array($result)){
foreach($row AS $key => $value) { $row[$key] = stripslashes($value); }
echo "<tr>";
echo "<td>" . nl2br( $row['name'] . "</td>";
echo "<td>" . nl2br( $row['email']) . "</td>";
echo "<td>" . $tv . "</td>";
echo "</tr>";
}
?>
i know I'm validating the data before i do the mysql_fetch_array and that should do it after, but i wasn't able to put the if statement in the echo
any help pls ?