Welcome Guest, Not a member yet? Register   Sign In
Display recent user updates form two tables
#1

[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
#2

[eluser]Nick_MyShuitings[/eluser]
First, wrong sub-forum, nothing about this could be construed as an error or bug.

Second... I can't wrap my head around what you are trying to do. It sounds like all you need to do is a select from posted or shared links, order by the date_added DESC, and limit by however many you want to return.

Are you not familiar with SQL? or how to run a Select query in codeigniter? in that case see the user guide it will hold your hand through the process.
#3

[eluser]eoinmcg[/eluser]
aside from being in the wrong sub forum...

well, you could refactor your 2 links tables into 1. add a 'type' field which can be either 'posted' or 'shared'. then a simply query like below would suffice;
$query = $this->db->order_by('date_add', 'DESC')->limit(20)->get('links');

alternatively, you could run 2 queries and merge the results.




Theme © iAndrew 2016 - Forum software by © MyBB