In case anyone wonders why printing array of a joined table duplicates the data:
http://stackoverflow.com/questions/4...ned-join-array
Anyway, if I have two tables joining together with identical coloumn names (in this case ID.) The array prints the second ID as a number, so I have to use $topic['10'];
For example
PHP Code:
[0] => 3
[id] => 12
[1] => 2
[category] => 2
[2] => Sample Post Title
[title] => Sample Post Title
[3] => Let's see if the favourite/save star icon shows up yellow or hidden and grey.
[text] => Let's see if the favourite/save star icon shows up yellow or hidden and grey.
[4] =>
[revised] =>
[5] =>
[locked] =>
[6] => 0
[replies] => 0
[7] => 2012-06-03 13:45:40
[date] => 2012-06-03 13:45:40
[8] => abracadabra
[username] => abracadabra
[9] => 1
[role] => 1
[10] => 12
PHP Code:
SELECT topics.id, topics.category, topics.title, topics.text, topics.revised, topics.locked, topics.replies, topics.date, users.username, users.role, users.id
FROM `forum topics` topics
LEFT JOIN users ON users.id = topics.author
WHERE slug='{$slug}'
Am I doing it wrong?