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."%' )";

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>

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.