Welcome Guest, Not a member yet? Register   Sign In
Query multiple tables and echo the result
#5

[eluser]bcorcoran[/eluser]
Ahhh, ok.

Here's a lesson in SQL:

If you have two tables you need to join (in your case), and the column names are colliding (i.e. both tables have ID field and you need to use each of them separately).

You want to do the following:

Code:
SELECT entries.id, entries.title, categories.id as cid, categories.title as ctitle

Then this will be $entry->cid and $entry->ctitle for cat id and cat title respectively.

Let me know if this doesn't make sense.


Messages In This Thread
Query multiple tables and echo the result - by El Forum - 09-07-2010, 01:28 PM
Query multiple tables and echo the result - by El Forum - 09-08-2010, 12:59 PM
Query multiple tables and echo the result - by El Forum - 09-08-2010, 01:34 PM
Query multiple tables and echo the result - by El Forum - 09-08-2010, 01:51 PM
Query multiple tables and echo the result - by El Forum - 09-08-2010, 02:21 PM
Query multiple tables and echo the result - by El Forum - 09-08-2010, 02:22 PM
Query multiple tables and echo the result - by El Forum - 09-08-2010, 02:23 PM
Query multiple tables and echo the result - by El Forum - 09-08-2010, 02:24 PM
Query multiple tables and echo the result - by El Forum - 09-08-2010, 05:07 PM



Theme © iAndrew 2016 - Forum software by © MyBB