Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> zamiana linku w zapytaniu
peterlan
post 18.02.2015, 10:14:16
Post #1





Grupa: Zarejestrowani
Postów: 131
Pomógł: 0
Dołączył: 25.10.2012

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


Witam, standardowo, czy ktos moze mi pomoc:

mam takie zapytanie:

  1. $raw_results = mysql_query("SELECT id,title,preis,active,text_beschr,gallery,status FROM uhren WHERE
  2. ((`id` LIKE '%".$query."%') OR
  3. (`title` LIKE '%".$query."%') OR
  4. (`text_beschr` LIKE '%".$query."%')) AND
  5. (active=1)
  6.  
  7. UNION SELECT id,title,preis,active,text_beschr,gallery,status FROM schmuck WHERE
  8. ((`id` LIKE '%".$query."%') OR
  9. (`title` LIKE '%".$query."%') OR
  10. (`text_beschr` LIKE '%".$query."%')) AND
  11. (active=1)
  12. ")


i w rezultacie chcialbym zmieniac linki w zaleznosci od tablei ktora zostala wyszukana

  1. <a href='http://strona.com/articlew.php?id=".$results['id']."'>



Chodzi o lokalizacje,

poniewaz pewne produkty znajduja sie w tabeli uhren a inne w schmuck

<a href='http://strona.com/articlew.php?id=".$results['id']."'>
<a href='http://strona.com/articlej.php?id=".$results['id']."'>


czy mozna to jakos prosto wprowadzic?

chodzi mi dokładnie..

jesli jest to produkt z tablei 'uhren' to link wyszukanego produktu prowadzi do:
strona.com/articlew.php

a jesli jest produkt z tabeli 'schmuck' to link jest:
strona/articlej.php
Go to the top of the page
+Quote Post
trueblue
post 18.02.2015, 10:17:52
Post #2





Grupa: Zarejestrowani
Postów: 6 799
Pomógł: 1827
Dołączył: 11.03.2014

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


  1. SELECT 'w' AS postfix,......
  2. UNION
  3. SELECT 'j' AS postfix,.......


  1. <a href='http://strona.com/article".$results['postfix'].".php?id=".$results['id']."'>


--------------------
Go to the top of the page
+Quote Post
peterlan
post 18.02.2015, 10:30:31
Post #3





Grupa: Zarejestrowani
Postów: 131
Pomógł: 0
Dołączył: 25.10.2012

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


ostatnie pytanie..

to mam tak wpisac?

  1. $raw_results = mysql_query("SELECT
  2. 'w' AS postfix,
  3. id,title,preis,active,text_beschr,gallery,status FROM uhren WHERE
  4. ((`id` LIKE '%".$query."%') OR
  5. (`title` LIKE '%".$query."%') OR
  6. (`text_beschr` LIKE '%".$query."%')) AND
  7. (active=1)
  8.  
  9. UNION SELECT
  10. 'w' AS postfix,
  11. id,title,preis,active,text_beschr,gallery,status FROM schmuck WHERE
  12. ((`id` LIKE '%".$query."%') OR
  13. (`title` LIKE '%".$query."%') OR
  14. (`text_beschr` LIKE '%".$query."%')) AND
  15. (active=1)
  16. ")


dzieki, o to mi chodzilo
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: 15.06.2025 - 10:55