I believe that it should look something like this:
$my_conn = new mysqli('localhost', 'user name', 'password', 'database name');
$sql = "SELECT * FROM messages";
$result = $my_conn->query($sql);
while ($obj = $result->fetch_object()) {
echo = $obj->message;
}
I could easily be wrong though ...
hope this helps,
Simon.