0

i have
3 table with different structure..

  • article (content of only text)
  • download (content of text,file and image)
  • market (text, image)

i want to show the search result from those table together but with different style (only text, or image, or both)
but when i use UNION --> work, but i cant decide the style to its table.

this is my code :

   query= "(SELECT judul,judul_seo,isi,id_kategori,id_sub, id_news as type FROM arc_news WHERE (judul LIKE '%".$search_string."%' OR isi LIKE '%".$search_string."%') and status='aktif')
    UNION
    (SELECT judul,judul_seo,isi,image,id_kattutor, id_tutor as type FROM tutor_news WHERE judul LIKE '%".$search_string."%' OR isi LIKE '%".$search_string."%' )";
2
Contributors
3
Replies
14
Views
3 Years
Discussion Span
Last Post by urtrivedi
0

You can decide style in query itself , by adding one more column. This column value you can use to decide style in html

query= "(SELECT 'arc_style' record_style, judul,judul_seo,isi,id_kategori,id_sub, id_news as type FROM arc_news WHERE (judul LIKE '%".$search_string."%' OR isi LIKE '%".$search_string."%') and status='aktif')
    UNION
    (SELECT 'tutor_style' record_style,judul,judul_seo,isi,image,id_kattutor, id_tutor as type FROM tutor_news WHERE judul LIKE '%".$search_string."%' OR isi LIKE '%".$search_string."%' )";

    .
    .
    .
    .

    <div class='{$row['record_style']}' > content</div>
0

okey i can fix it now
then ??
how if i want to give a paging to my query??
may you have script?

Edited by Linddha

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.