Echo image
Posted: Thu Nov 04, 2010 9:49 am
Hi, I need some help with some PHP code please.
I have a database with a table 'users' with an attribute 'status', set to default '0', and when a user logs in this changes to '1'.
I have then echoed the results of this table with something like so:
...what I want to do is, if a user is online, echo a <td> with an image in it (rather than $rows['status']), say a green square, and a red square if they are offline.
To echo the image it's obviously (something like):
...what I am asking is how do i defferentiate between the '1' for online and the '0' for offline in the code?
Thanks in advance for any replies...
I have a database with a table 'users' with an attribute 'status', set to default '0', and when a user logs in this changes to '1'.
I have then echoed the results of this table with something like so:
Code: Select all
$query=mysql_query("SELECT * FROM userTable;");
echo "<table>";
//while loop for rows
while($rows=mysql_fetch_array($query)){
echo "<tr>";
echo "<td>" . $rows['username'] . "</td>" . "<td>" . $rows['status'] . "</td>";
echo "</tr>";
}To echo the image it's obviously (something like):
Code: Select all
echo '<img src="someLocation/thisImage.jpg">';Thanks in advance for any replies...