1.) You don't assign the connection to a variable (no big deal) but you also don't check to see if you connected:
mysql_connect('localhost', $username, $password);
mysql_select_db($db);
2.) Your syntax is wrong here. You need to encapsulate strings in quotes:
$query = Select messageFrom, messageSubject, messageDate
from cw_message
where user = "$authuser";
3.) This is a deprecated way of getting the number of rows returned, and you should instead use mysql_num_rows:
mysql_numrows($result);
// Should use:
mysql_num_rows($result);
4.) This can be reduced to a simple while loop. Also, you have a syntax error in your string concatenation. You really should watch it:
$counter = 0;
while ($counter < $numRows)
{
$from = mysql_result($result, $counter, "messageFrom");
$subject = mysql_result($result, $counter, "messageSubject");
$date = mysql_result($result, $counter, "messageDate");
echo $from "<BR>";
echo $subject "<BR>";
echo $date "<BR>";
$counter ++;
//echo "The While Statement Works!";
}
so it becomes:
while($row = mysql_fetch_array($result))
{
echo $row['messageFrom'] . "<BR>";
echo $row['messageSubject'] . "<BR>";
echo $row['messageDate'] . "<BR>";
//echo "The While Statement Works!";
}