connect(); $this->storeInDB($PIR, $Duration); } function connect(){ $this->link = mysqli_connect('localhost','root','') or die('Cannot connect to the DB'); mysqli_select_db($this->link,'electrovanne') or die('Cannot select the DB'); } function storeInDB($PIR, $Duration){ $query = "insert into pir set Duration='".$Duration."', PIR='".$PIR."'"; $result = mysqli_query($this->link,$query) or die('Errant query: '.$query); } } if($_GET['PIR'] != '' and $_GET['Duration'] != ''){ $pir=new pir($_GET['PIR'],$_GET['Duration']); } ?>