Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [MYSQL] błąd w zapytaniu
stirith
post 25.03.2009, 10:27:46
Post #1





Grupa: Zarejestrowani
Postów: 162
Pomógł: 2
Dołączył: 18.01.2008

Ostrzeżenie: (0%)
-----


Co jest źle w zapytaniu :

Kod
$query = "SELECT * FROM id WHERE key != key_f";



(tabeli id, są 2 kolumny key i key_f)

wyskakuje błąd

Cytat
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 'key != key_f' at line 1
Go to the top of the page
+Quote Post
nospor
post 25.03.2009, 10:30:08
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




mysql nie ma !=
jest za to <>


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
stirith
post 25.03.2009, 10:35:30
Post #3





Grupa: Zarejestrowani
Postów: 162
Pomógł: 2
Dołączył: 18.01.2008

Ostrzeżenie: (0%)
-----


ten sam blad

Cytat
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 'key <> key_f' at line 1


Ten post edytował stirith 25.03.2009, 10:36:07
Go to the top of the page
+Quote Post
nospor
post 25.03.2009, 10:37:28
Post #4





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




key jest slowem zastrzezonym
  1. SELECT * FROM id WHERE `key` <> key_f


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
stirith
post 25.03.2009, 10:39:04
Post #5





Grupa: Zarejestrowani
Postów: 162
Pomógł: 2
Dołączył: 18.01.2008

Ostrzeżenie: (0%)
-----


co to znaczy zastrzeżonym ?
Go to the top of the page
+Quote Post
nospor
post 25.03.2009, 10:40:29
Post #6





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 18.07.2025 - 02:38