News by category - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: News by category (/showthread.php?tid=19339) |
News by category - El Forum - 06-04-2009 [eluser]Guerra[/eluser] Hi all, how to withdraw all news relating to certain categories? Categories output in url site/name e.g. $name = $this->uri->segment(1) :gulp: Can anyone show an example? News by category - El Forum - 06-04-2009 [eluser]Dam1an[/eluser] You would need a lookup to get the category ID based on the name If a news story can only have a single category, then its just a simple where clause, if it can have many categories, you will need a join in there as well News by category - El Forum - 06-04-2009 [eluser]Guerra[/eluser] Can you pls demonstrate how to query the database? News by category - El Forum - 06-04-2009 [eluser]Dam1an[/eluser] Have a look at the user guide It's all simple enough News by category - El Forum - 06-04-2009 [eluser]xwero[/eluser] Dam1an i think you took over my patience because i got tired answering questions like that. I promote you to Sr. Research Associate if i was in charge News by category - El Forum - 06-04-2009 [eluser]wiredesignz[/eluser] [quote author="xwero" date="1244136061"]...I promote you to Sr. Research Associate if i was in charge [/quote] +1 for Damian News by category - El Forum - 06-04-2009 [eluser]TheFuzzy0ne[/eluser] That would certainly be a big improvement on his current position - tea lady. News by category - El Forum - 06-04-2009 [eluser]Dam1an[/eluser] Thanks guys, now if you could put in a good word with the mods And Fuzzy, after that insult, you better be careful with the coffee I serve you, never know whats going to be in it lol News by category - El Forum - 06-04-2009 [eluser]Guerra[/eluser] Dam1an THX. How correct write this query to AR? $Q = $this->db->query("SELECT * FROM topics, category WHERE cat_name = category.name AND cat_name = '$name'"); return $Q->result_array(); |