Sto cercando di creare un database da utilizzare online per la ricerca, ma quando provo a fare la ricerca mi da questo errore:

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given in C:\xampp\xampp\htdocs\alunni\librerie\mysql.inc.ph p on line 16

codice:
<?php
    require_once 'Connection.inc.php';

    $connection = mysql_connect ($host, $username, $password) 
	or die ('Connessione al database fallita. ' . mysql_error()); 
    mysql_select_db($name)
    or die('Non posso selezionare il DB. ' . mysql_error());

    function query($sql)
    {    
        $result = mysql_query($sql) or die(mysql_error());
     }

    function fetch_assoc($result)
    {
        return mysql_fetch_assoc($result);
    }

    function num_rows($result)
    {
        return mysql_num_rows($result);
    }
?>
ecco il file che ho incluso sopra:
codice:
<?php
    $host = 'localhost';
    $username = 'root';
    $password = '';
    $name = 'ex-alunni';

    require_once 'mysql.inc.php';
    require_once 'header-footer.inc.php';
?>
Sto impazzendo da matti :dhò