Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z zapytaniem
Peqper
post 4.02.2008, 22:27:56
Post #1





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 1.02.2008

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


Witam.

Jak wykonać zapytanie do bazy:

$zapytanie = "select * from szkoly s, miasta m
where s.miasto=m.id_miasta
and s.nazwa like '% XXX %'
group by s.nazwa;";

z tym, że w miejsce XXX wstawić zmienną, np. $cos?

Zapytanie o poniższej formie nie działa:/

$zapytanie = "select * from szkoly s, miasta m
where s.miasto=m.id_miasta
and s.nazwa like '%$cos%'
group by s.nazwa;";
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 4)
Piniek
post 4.02.2008, 22:31:04
Post #2





Grupa: Przyjaciele php.pl
Postów: 463
Pomógł: 49
Dołączył: 27.12.2007
Skąd: Warszawa

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


{zmienna}
chyba ;P

Pozdrawiam i mam nadzieje ze pomoglem.


--------------------
Go to the top of the page
+Quote Post
Cysiaczek
post 4.02.2008, 22:36:14
Post #3





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




  1. $zapytanie = "select * from szkoly s, miasta m
  2. where s.miasto=m.id_miasta and s.nazwa like '%".$cos."%'
  3. group by s.nazwa;";


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
Go to the top of the page
+Quote Post
Peqper
post 4.02.2008, 23:08:42
Post #4





Grupa: Zarejestrowani
Postów: 10
Pomógł: 0
Dołączył: 1.02.2008

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


Niestety żadna z dwóch propozycji nie działa:/ Jakieś inne pomysły?
Go to the top of the page
+Quote Post
Cysiaczek
post 4.02.2008, 23:57:19
Post #5





Grupa: Moderatorzy
Postów: 4 465
Pomógł: 137
Dołączył: 26.03.2004
Skąd: Gorzów Wlkp.




To może powiesz, jaki błąd wyskakuję? Czy mam się sami domyślać?


--------------------
To think for yourself you must question authority and
learn how to put yourself in a state of vulnerable, open-mindedness;
chaotic, confused, vulnerability, to inform yourself.
Think for yourself. Question authority.
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: 13.08.2025 - 23:28