Q:

problems doing a query to mysql - boolean given

I am trying to do a very simple CRUD operation, actually I've just started, so I'm "reading", the easiest step and something is wrong already!
PHP code
 <?php 
    global $conn;

    $query = "SELECT * FROM usuaris";
    if ($grup_usuaris = mysqli_query($conn, $query)) {
        echo "<table>";
        echo "<tr><th>Usuaris</th></tr>";
        while($row = mysqli_fetch_array($grup_usuaris)) {
            echo "<tr><td>" . $row['usuari_nom'] . "</td></tr>";
        }
    } else {
        echo "query failed";
    } 
    mysqli_free_result($grup_usuaris);

    echo "</table>";            
?>

So my table is called usuaris, and I am just trying to display the usuari_nom column (there is actually only one column in my table a part from the id!), but it says 

mysqli_free_result() expects parameter 1 to be mysqli_result, boolean
  given

On this line: mysqli_free_result($grup_usuaris);
I understand I am treating $grup_usuaris as object, but it is an array. Isn't it? 
UPDATE
So I've thought I'm missing some stuff, like the file that processes that query:
connection_db.php
<?php
// information about our database connection and table we want to work on
$servername = "localhost";
$username = "eve";
$password = "pass123";

// Create connection
$conn = mysqli_connect($servername, $username, $password);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
?>

Then calendari.php where I want to display the results:
<?php require_once("includes/connection_db.php"); ?>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Calendari Papa</title>
    <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <link href="css/bootstrap-theme.min.css" rel="stylesheet" type="text/css"/>
    <link href="css/estils.css" rel="stylesheet" type="text/css"/>
  </head>
  <body>
<div id="main">
        <?php 
    global $conn;

    $query = "SELECT * FROM usuaris";

    if($grup_usuaris = mysqli_query($conn, $query)) {
         echo "<table>";
         echo "<tr><th>Usuaris</th></tr>";
             while($row = mysqli_fetch_array($grup_usuaris)) {
                 echo "<tr><td>" . $row['usuari_nom'] . "</td></tr>";
             }
         echo "</table>";
         mysqli_free_result($grup_usuaris);
    } else {
        echo "query failed";
    }           
        var_dump($grup_usuaris);
        ?>
    </div>
    <script src="js/jquery-1.11.3.min.js" type="text/javascript"></script>
    <script src="js/jquery.ddslick.js" type="text/javascript"></script>
    <script src="js/bootstrap.min.js" type="text/javascript"></script>
    <script src="js/scripts.js" type="text/javascript"></script>
  </body>
</html>

<?php require_once("includes/connection_db_close.php"); ?>

Page with the form to to create usuari called crea_usuari.php:

Tornar a intentar-ho";
            echo "Tornar al calendari";
          }

    } else {
        //This is probably a GET request
        redirect_to("nou_usuari.php");
    }

    ?>
    

And then the file that processes the form called nou_usuari.php
<?php require_once("includes/connection_db.php"); ?>

<div>
  <div id="page"><!--We want the content of the pages on the right-->
    <h2>Crea un usuari nou</h2>
      <form action="crea_usuari.php" method="POST">
        <p>Nom del nou usuari:
          <input type="text" name="usuari_nom" value="" />
        </p>  
        <input type="submit" name="submit" value="Crea usuari" />
    </form>
    <br />
    <a href="calendari.php">Cancel</a>
  </div>
</div>

<?php require_once("includes/connection_db_close.php"); ?>

Mention: redirect_to() is a built function I haven't put but it is not the error.

A:

EDIT for the answer:
It seems you did not specify a database to query on. In your connection_db.php you only connected to the database server. You did not specify a database (schema) to query on. So add this to your connection_db.php so it will look like this:
<?php
    // information about our database connection and table we want to work on
    $servername = "localhost";
    $username = "eve";
    $password = "pass123";
    $database = "your database schema";

    // Create connection
    $conn = mysqli_connect($servername, $username, $password, $database);

    // Check connection
    if (mysqli_connect_errno())
    {
        echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }
?>

Steps taken to discover the problem:
As i take a look at your code and do a simple google search. I come across this explaination: w3schools mysqli free result
Your code should look like this:
<?php 
    global $conn;

    $query = "SELECT * FROM usuaris";
    
    if($grup_usuaris = mysqli_query($conn, $query)) {
         echo "<table>";
         echo "<tr><th>Usuaris</th></tr>";
             while($row = mysqli_fetch_array($grup_usuaris)) {
                 echo "<tr><td>" . $row['usuari_nom'] . "</td></tr>";
             }
         echo "</table>";
         mysqli_free_result($grup_usuaris);
    } else {
        echo "query failed";
    }          
?>

(I also placed the closing table tag inside the if statement as the opening tag is only outputted if the If statement returns true.)
As far as i read, the mysqli_free_result() frees up the memory associated with the query result. As the query result is probably only set when it returns true, you should only free it up inside the if statement.
EDIT:
As removing the "global $conn;" does not solve the problem. I began researching from scratch. As w3schools uses a different function to display connection errors, try this in your connection_db.php:
if (mysqli_connect_errno())
{
    echo "Failed to connect to MySQL: " . mysqli_connect_error();
}

As of the $grup_usuaris = mysqli_query($conn, $query):
For successful SELECT, SHOW, DESCRIBE, or EXPLAIN queries it will return a mysqli_result object. For other successful queries it will return TRUE. FALSE on failure.

So i guess your query is failing?
Try putting this in your else: echo("Error description: " . mysqli_error($conn));
So your code looks like:
if($grup_usuaris = mysqli_query($conn, $query)) {
    ....
} else {
    echo("Error description: " . mysqli_error($conn));
}

This might help debugging.
Also: mysqli_fetch_array() outputs an array with indices. So $row[0] will correspond to colum 1 in your table. User mysqli_fetch_assoc() to use the colum names as indices whilst outputting $row.
Hope it helps.

