CodeIgniter Forums
Display recent user updates form two tables - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: Display recent user updates form two tables (/showthread.php?tid=41333)



Display recent user updates form two tables - El Forum - 05-04-2011

[eluser]ram reddy[/eluser]
Hi to all,


i have one problem , present working on link sharing project . here i have two tables 1. posted_links 2. shared_links

Posted_links table view => id, user_id, link_id, date_add

Shared_links table view => id, user_id, link_id, date_add

Aboue two tables collected in formation from ‘link’ table ; table view => id , link_id, url, title

My question is how to display recent user updates from posted_links and shared_links. Pls help to me


Display recent user updates form two tables - El Forum - 05-04-2011

[eluser]ram reddy[/eluser]
its working for me

$query1 = $this->db->get('Example_Table1');
$join1 = $this->db->last_query();
$query2 = $this->db->get('Example_Table2');
$join2 = $this->db->last_query();
$union_query = $this->db->query($join1.' UNION '.$join2.' ORDER BY column1,column2);