Can someone help its not displaying my on/off images I just get an error saying "auth is empty dammit! "
DB Structure
table name : auth
======
| auth |
--------
| on |
--------
DB Structure
table name : auth
======
| auth |
--------
| on |
--------
PHP Code:
<?
$sql = "SELECT * FROM auth";
$conn = mysql_connect('localhost', 'usr', 'pw') or print mysql_error();
mysql_select_db('chat', $conn);
$result = mysql_query($sql, $conn) or print mysql_error();
while ($row = mysql_fetch_array($result)) {
$auth = $row['auth'];
if (!$auth || $auth == null) {$auth = "auth is empty dammit!";}
if ($auth == 'off') {
$access = "<img src='../lobby/images/off.gif'>Open access is off you must register";
} elseif ($auth == 'on') {
$access = "<img src='../lobby/images/on.gif'>Open Access is on";
} else {
$access = "error -- $auth";
}
}
echo "$access";
?>
Comment