PDA

View Full Version : [PHP][MySQL] Errore nella query


robertino_salemi
13-01-2015, 12:42
Salve a tutti,
ottengo il seguente errore:
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 6

nella seguente query:

//SELEZIONE TUTTE LE FOTO DEL CONTEST E VERIFICO SE C'E' IL FILTRO PER UTENTE
$filter_by_user = "AND CompetitorID = " . $getCurrentUser. " ";

$qq_foto = "SELECT
*
FROM
works_2014
WHERE
ContestID = " . $currentContest['ID'] . " " . $filter_by_user;

$q_foto = mysql_query($qq_foto) or die (mysql_error());


secondo voi dov'è l'errore?

Grazie.

Daniels118
13-01-2015, 15:33
Alla riga 6 :D
Aggiungi
echo htmlspecialchars($qq_foto);
prima di mysql_query e scrivi qui l'output.

robertino_salemi
13-01-2015, 20:06
Esatto, tramite l'ECHO mi sono accorto che il $getCurrentUser non era valorizzato.

Scusatemi e grazie! ;)