function testdbRoomLogsModule()
 {
     // Creates some room logs to add to the database
     $today = date('y-m-d');
     $roomLog1 = new RoomLog($today);
     $roomLog2 = new RoomLog("11-02-07");
     // Alter the status and log notes of a room
     $roomLog2->set_log_notes("Room Log 2");
     $roomLog2->set_status("archived");
     // test the insert function
     $this->assertTrue(insert_dbRoomLog($roomLog1));
     $this->assertTrue(insert_dbRoomLog($roomLog2));
     // test the retrieve function
     $this->assertEqual(retrieve_dbRoomLog($roomLog1->get_id())->get_status(), "unpublished");
     $this->assertEqual(retrieve_dbRoomLog($roomLog2->get_id())->get_status(), "archived");
     // test the update function
     $roomLog1->set_log_notes("Room Log 1 notes");
     $this->assertTrue(update_dbRoomLog($roomLog1));
     $this->assertEqual(retrieve_dbRoomLog($roomLog1->get_id())->get_log_notes(), "Room Log 1 notes");
     // test the delete function
     $this->assertTrue(delete_dbRoomLog($roomLog1->get_id()));
     $this->assertFalse(retrieve_dbRoomLog($roomLog1->get_id()));
     $this->assertTrue(delete_dbRoomLog($roomLog2->get_id()));
     echo "testdbRoomLogs complete";
 }
function retrieve_mostrecent_dbRoomLog($date)
{
    // connect to the mysql server
    connect();
    // Retrieve the entry
    $query = "SELECT * FROM dbRoomLogs WHERE id <='" . $date . "' ORDER BY id DESC";
    $result = mysql_query($query);
    // check if successful
    if (mysql_num_rows($result) == 0) {
        mysql_close();
        return false;
    }
    // Store the first row of the result = the most recent room log
    $result_row = mysql_fetch_assoc($result);
    mysql_close();
    // Create a new room log from the information given
    $theRoomLog = new RoomLog($result_row['id']);
    // Replace the rooms in the room log
    $roomsString = $result_row['rooms'];
    $rooms = explode(",", $roomsString);
    $theRoomLog->set_rooms($rooms);
    // Add extra information if present
    if ($result_row['log_notes']) {
        $theRoomLog->set_log_notes($result_row['log_notes']);
    }
    if ($result_row['status']) {
        $theRoomLog->set_status($result_row['status']);
    }
    // return the roomlog
    return $theRoomLog;
}