Ciao a tutti,
stò cercando di imparare il mondo php+mysql...ma ho un problema...
Quando vado ad eseguire il seguente codice mi dà l'errore "sintax error, unexpected $end on line 50"...la linea 50 sarebbe quella del tag di chiusura PHP...
ho controllato e ricontrollato ma non riesco a capire dove sia l'errore, sicuramente sarà una banalità e chiedo scusa per la mia domanda stupida, ma non riesco a trovarlo ed a proseguire nei miei esericizi...
codice:
<?php
//collegamento a MySQL
$db=mysql_connect('localhost','aa','aapass') or die('Unable to connect. Check your connection parameters.');
//ci si assicura di usare il database corretto
mysql_select_db('prova',$db) or die(mysql_error($db));
//recupera le informazioni
$query='SELECT movie_name, movie_year, movie_director, movie_leadactor, movie_type
FROM movie
ORDER BY movie_name ASC, movie_year DESC';
$result=mysql_query($query,$db) or die(mysql_error($db));
//determina il numero di righe nel risultato restituito
$num_movies=mysql_num_rows($result);
$table = <<<ENDHTML
<div style="text-align: center;">
<h2>Movie Review Database</h2>
<table border="1" cellpadding="2" cellspacing="2" style="width: 70%; margin-left: auto; margin-right: auto;">
<tr>
<th>Movie Title</th>
<th>Year of Release</th>
<th>Movie Director</th>
<th>Movie Lead Actor</th>
<th>Movie Type</th>
</tr>
ENDHTML;
//scorrere i risultati
while($row=mysql_fetch_assoc($result))
{
extract($row);
$table .= <<<ENDHTML
<tr>
<td>$movie_name</td>
<td>$movie_year</td>
<td>$movie_director</td>
<td>$movie_leadactor</td>
<td>$movie_type</td>
</tr>
ENDHTML;
}
$table .= <<<ENDHTML
</table>
$num_movies Movies</p>
</div>
ENDHTML;
echo $table;
?>