Try this instead. Use the mysql_fetch_array() function. Also, it may be easier to escape php then hop back in. This is a good idea if you are used to HTML formatting.
<?php
mysql_connect('localhost', 'XXXXXX', 'XXXXXX') or die(mysql_error());
mysql_select_db('DB_XXXXXX) or die(mysql_error());
$query = mysql("SELECT * FROM users");
$rows = mysql_num_rows($query);
while($data=mysql_fetch_array($query)){
?>
<br>
<table width="50%" align="left" border="0">
<tr>
<td><?php echo $data['username']?> </td>
<td><?php echo $data['fname'].''.$data['lname'] ?></td>
</tr>
</table>
</left>
<?php
}
?>
You can also define the variables before jumping into HTML. Like this:
while($data=mysql_fetch_array($query)){
$username = $data['username'];
$fullname = $data['fname'].''.$data['lname'];
?>
<br>
<table width="50%" align="left" border="0">
<tr>
<td><?php echo $username ?> </td>
<td><?php echo $fullname ?></td>
</tr>
</table>
</left>
<?php
}
?>
The above is great, because you define the variables ahead of time, and can use it through the rest of the while loop.