Salve,
problema di oggi :

nei miei studi mi sono ritrovato a creare un codice come esercitazioni ma nel browser mi compare questo errore:

codice:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 7
Ovviamente ho riletto tutto il codice più volte ma sinceramente io non vedo nessun errore o variabilie confusa o raba del genere. Qualche anima pia vede qualcosa? O, considerando che cmq uso dreamweaver come editor che già mi segnale eventuali errori di sintassi, esiste qualche programma, attendibile, che aiuta a rintraccire errori?

Il codice è il seguente:

Codice PHP:
<?php
// riceve l'identificativo di un regista e ne restiruisce il nome completo
function get_director ($director_id) {
    
    global 
$db;
    
    
$query 'SELECT
            people_fullname
        FROM
            people
        WHERE
            people_id =' 
.$director_id;
    
$result mysql_query($query$db) or die (mysql_error($db));
    
    
$row mysql_fetch_assoc ($result);
    
extract($row);
    
    return 
$people_fullname;
}

// riceve l'identificativo di un attore e ne restiruisce il nome completo
function get_leadactor ($leadactor_id) {
    
    global 
$db;
    
    
$query 'SELECT
            people_fullname
        FROM
            people
        WHERE
            people_id =' 
.$leadactor_id;
    
$result mysql_query ($query$db) or die (mysql_error($db));
    
    
$row mysql_fetch_assoc ($result);
    
extract ($row);
    
    return 
$people_fullname;
}

// riceve l'identificativo di un tipo di film e ne restiruisce il nome completo
function get_movietype ($type_id) {
    
    global 
$db;
    
    
$query 'SELECT
            movietype_label
        FROM
            movietype
        WHERE
            movietype_id =' 
.$type_id;
    
$result mysql_query ($query$db) or die (mysql_error($db));
    
    
$row mysql_fetch_assoc ($result);
    
extract ($row);
    
    return 
$movietype_label;
}

// funzione per calcolare se un film ha generato un profitto, una perdita o è in pareggio
function calculate_differences ($takings$cost) {
    
    
$difference $takings $cost;
    
    if (
$difference 0) {
        
$color 'red';
        
$difference '$' abs($difference) . 'milioni';
    }elseif (
$difference 0) {
        
$color    'green';
        
$difference '$' $difference 'milioni';
    }else{
        
$color 'blue';
        
$difference 'pareggio';
    }
    
    return 
'<span style="color:' $color ';">' .$difference '</span>';
}

//Collegamento a MySQL (ovviamente qui i dati sono inseriti)
$db mysql_connect ('''''') or 
    die (
"Impossibile connettersi, verifica i parametri d'accesso");

//seleziona il database  preimpostato da altervista in alternativa andrebbe creato
mysql_select_db (''$db) or die (mysql_error($db));

//recupera le informazioni
$query 'SELECT
        movie_name, movie_year, movie_director, movie_leadactor,
        movie_type, movie_running_time, movie_cost, movie_takings
    FROM
        movie
    WHERE
        movie_id = '
$_GET['movie_id'];
$result mysql_query ($query$db) or die (mysql_error($db));

$row mysql_fetch_assoc($result);
$movie_name            $row['movie_name'];
$movie_director        get_director ($row['movie_director']);
$movie_leadactor    get_leadactor($row['movie_leadactor']);
$movie_year            $row['movie_year'];
$movie_running_time $row['movie_running_time'];
$movie_takings        $row['movie_takings'];
$movie_cost            $row['movie_cost'];
$movie_health        calculate_differences ($row['movie_takings'], $row['movie_cost']);

//mostra le informazioni

echo <<<ENDHTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Dettagli e Profitti di: 
$movie_name</title>
</head>

<body>
<div style="text-aling: center;">
<h2>
$movie_name</h2>
<h3>[i]Dettagli[i]</h3>
<table cellpadding="2" style="width: 70%; margin-left: auto; margin-rigth: auto;">
<tr>
<td>[b]Titolo[/b]</td>
<td>
$movie_name</td>
<td>[b]Data di Uscita[/b]</td>
<td>
$movie_year</td>
</tr><tr>
<td>[b]Regista[/b]</td>
<td>
$movie_director</td>
<td>[b]Costo[/b]</td>
<td>
$movie_cost</td>
<td>[b]Regista[/b]</td>
<td>
$movie_leadactor</td>
<td>[b]Incassi[/b]</td>
<td>
$movie_takings</td>
</tr><tr>
<td>[b]Durata[/b]</td>
<td>
$movie_running_time</td>
<td>[b]Profitto[/b]</td>
<td>
$movie_health</td>
</tr>
</table>
</div>
</body>
</html>
ENDHTML;
?>
Ringrazio anticipatamente quanti abbiano la pazienza e la dote x aiutarmi.!!