franco7scala
Utente Attivo
- Messaggi
- 40
- Reazioni
- 0
- Punteggio
- 26
devo fare questa query da java:
SELECT *
FROM messaggi
WHERE messaggi.receiver='Franco' AND
messaggi.letto=false
questo è il codice che ho scritto:
ma mi da quest'errore:
Codice errore1064
MESSAGgIo err0re 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 '.receiver='Franco' AND messaggi.letto=false' at line 1
cosa devo fare?
grazie
SELECT *
FROM messaggi
WHERE messaggi.receiver='Franco' AND
messaggi.letto=false
questo è il codice che ho scritto:
Codice:
[FONT=Monaco][COLOR=#961a65]public[/COLOR] [COLOR=#961a65]synchronized[/COLOR] LinkedList<Messaggio> ricevi() [COLOR=#961a65]throws[/COLOR] SQLException, IOException {[/FONT]
LinkedList<Messaggio> ll=[COLOR=#961a65]new[/COLOR] LinkedList<Messaggio>();
String receive=[COLOR=#3b3df5]"SELECT *"[/COLOR] +
[COLOR=#3b3df5][COLOR=#000000] [/COLOR]"FROM messaggi"[COLOR=#000000] +[/COLOR][/COLOR]
[COLOR=#3b3df5][COLOR=#000000] [/COLOR]"WHERE messaggi.receiver=? AND"[COLOR=#000000] +[/COLOR][/COLOR]
[COLOR=#3b3df5][COLOR=#000000] [/COLOR]" messaggi.letto=false"[COLOR=#000000];[/COLOR][/COLOR]
PreparedStatement p=[COLOR=#032fc3]connettore[/COLOR].connection().prepareStatement(receive);
p.setString(1, [COLOR=#032fc3]utente[/COLOR].getNickname());
p.execute();
ResultSet r=p.getResultSet();
[COLOR=#961a65]while[/COLOR](r.next()){
ConnettoreDelleInformazioni c=[COLOR=#961a65]new[/COLOR] ConnettoreDelleInformazioni(r.getString(1));
Utente sender=c.getUtente();
ll.addLast([COLOR=#961a65]new[/COLOR] Messaggio(sender, [COLOR=#032fc3]utente[/COLOR], r.getString(3), r.getString(4), r.getBoolean(5)));
}
[COLOR=#032fc3]connettore[/COLOR].connection().close();
[COLOR=#961a65]return[/COLOR] ll;
[FONT=Monaco] }[/FONT]
ma mi da quest'errore:
Codice errore1064
MESSAGgIo err0re 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 '.receiver='Franco' AND messaggi.letto=false' at line 1
cosa devo fare?
grazie