From the looks of your code I had assumed that you had a column for user so I put one into a test database, so you will either need to add a column 'user' or change the query here is the SQL structure for how I tested your script.
CREATE TABLE `cw_message` (
`id` smallint(4) NOT NULL auto_increment,
`message` text NOT NULL,
`messageFrom` varchar(35) NOT NULL,
`messageSubject` varchar(35) NOT NULL,
`messageDate` datetime NOT NULL,
`user` varchar(35) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;
--
-- Dumping data for table `cw_message`
--
INSERT INTO `cw_message` VALUES (1, 'This is the test turkey message just to fool around with the database.', 'Steve', 'Turkeys', '2006-04-11 20:02:00', '1234');
INSERT INTO `cw_message` VALUES (2, 'This is another funny message just for testing to see what ', 'Robert', 'Bees', '2006-04-11 00:00:00', '1234');
Run That query and it will make two rows in your database and your code will work.
OR just change your query to this and you can test without adding a user field.
$query = "SELECT messageFrom, messageSubject, messageDate
FROM cw_message ";