<?php
	$conn = new mysqli("94.46.181.151", "rodrigon_omsl", "aJ7jt48IFTBa", "rodrigon_omsl");

	// Check connection
	if ($conn->connect_error) {
	  die("Connection failed: " . $conn->connect_error);
	}

	$sql = "SELECT * FROM opinions WHERE question_id = '".$_GET["q"]."' AND inserted = '0'";
	$result = mysqli_query($conn, $sql);

	if (mysqli_num_rows($result) > 0) {
  // output data of each row
  while($row = mysqli_fetch_assoc($result)) {
  	$sql = "UPDATE opinions SET inserted = 1 WHERE id = ".$row["id"];
	$result = mysqli_query($conn, $sql);

    echo $row["opinion"]."¶".$row["name"]."¶".$row["city"]."¶".$row["age"]."||";
    break;
  }
} else {
	echo "false";
}

	mysqli_close($conn);
?>