Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP]Proste pytanie o php
artursztuka
post
Post #1





Grupa: Zarejestrowani
Postów: 6
Pomógł: 0
Dołączył: 11.04.2012

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




Prosze o pomoc

Mam baze postgre 9x i nie działa poniższe zapytanie o typ oferty "offerHasOfferType". Przy postgre 8x działało.

Jeśli na stałe tutaj dodam tabele offerHasOfferType to działa, ale jeżeli użytkownik nie wybierz typu oferty to nie pokazuje sie nic na stronie.

from
offers, cities, countries, "cantonmentTypes", "serviceHasOffers" "+offerHasOfferType"


Jak zrobić warunek żeby nie uwzgledniac w zapytaniu sql listy tabel - tabeli offerHasOfferType w momencie jak nie jest podany w wyszukiwarce typ oferty

czyli jezeli jest typ oferty to lista tabel z których ma pobrac dane:
offers, cities, countries, "cantonmentTypes", "serviceHasOffers", "offerHasOfferType"

a jak nie ma to:
offers, cities, countries, "cantonmentTypes", "serviceHasOffers"


================


if (is_numeric($link['typ']))
{
$tabela = ', "offerHasOfferType" ';
$dodaj = $dodaj.' and "offerHasOfferType"."offerId"=offers."offerId" and "offerHasOfferType"."offerTypeId"='.$link['typ'].' ';
}



$sql = 'select offers."offerId",offers.name,offers."galleryId",offers.description,offers."pictureId", cities.name as miasto, countries.name as kraj, "cantonmentTypes".name as nocleg, (select price from termins where termins."offerId"=offers."offerId" and termins."currencyId"=1 order by termins.price asc limit 1) as cena, (select "dateFrom" from termins where termins."offerId"=offers."offerId" and termins."dateFrom">\''.$dzis.'\' order by termins."dateFrom" asc limit 1) as terminod
from
offers, cities, countries, "cantonmentTypes", "serviceHasOffers"
where
offers."isActive"=true and
cities."cityId"=offers."cityId" and
countries ."countryId"=offers."countryId" and
"cantonmentTypes"."cantonmentTypeId"=offers."cantonmentTypeId" '.$dodaj.' and '.$warunek_dod.'
order by terminod,cena asc, offers."offerId" desc limit 15 offset '.$granica.' ';

Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
--artursztuka--
post
Post #2





Goście







A możesz coś więcej napisać?, bo nie mam zbyt dużej wiedzy na ten temat.
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 27.09.2025 - 22:35