Retrieve more data

Post here is you are having problems with any of the tutorials.
Post Reply
arunjoseph
Posts: 7
Joined: Thu Feb 23, 2012 11:25 am

Retrieve more data

Post by arunjoseph »

According to your blogging tutorial data from post and comment table is retrieved. But what if I want to retrieve data from categories table and which has a cat_id, cat_name and users table that has u_id and user_name. So in the get_posts() function I want the cat_name and user_name to retrieve this thing. Clear with the question? Please let me know. In my posts table there is p_id, p_title, p_body, cat_id, user_id
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Retrieve more data

Post by Temor »

I'm not sure I understand what your problem is. Are you trying to fetch information from another table?
What have you tried so far?
arunjoseph
Posts: 7
Joined: Thu Feb 23, 2012 11:25 am

Re: Retrieve more data

Post by arunjoseph »

Actually yes.. and with that the progress is something like I tried to expand the sql statement that was made by Jacek but it didn't go so good..
User avatar
Temor
Posts: 1186
Joined: Thu May 05, 2011 8:04 pm

Re: Retrieve more data

Post by Temor »

You would probably have to write a new sql statement.

[syntax=sql]SELECT `cat_id`, `cat_name`, `u_id`, `user_name` FROM `another_table`[/syntax]

if that is what you mean. Without seeing any code I'm not actually too sure what you want to accomplish :P
Post Reply