LCD prints then goes blank

I have connected a 16x2 LCD display to my Arduino and when i try to write to it the text apears on the screen. But after a few seconds it goes blank, and if i press the reset button the same thing happens again. But if i remove all the pins at once (except the power) the last text that i wrote to the screen appears. Any help would be greatly appreciated!

#include <LiquidCrystal.h>

LiquidCrystal lcd(4, 5, 6, 7, 8, 9);

void setup() {
  lcd.begin(16, 2);
  lcd.print("Hello world");
}

void loop() {
}

A good photo of your wiring and any links to components, will get responses.