Last poster avatar in forumlist
martec Offline
Junior Member
**
Posts: 3
Joined: Jun 2012
Post: #3
RE: Last poster avatar in forumlist
(06-13-2012 11:10 PM)ZiNgA BuRgA Wrote:  That part should be fine, though I recommend prefixing all other fields with "f.", eg "f.pid", "f.disporder".
Just be aware that "SELECT *, f.*" is ambiguous - you may wish to remove the first *

That won't really harm your forum anyway, so just try it out on a test board (or if you're lazy like me, just chuck it up on your live board and fix it up if you get an SQL error).

thanks reply...
this code i tested locally and work fine...

but as I did not know what could cause problems by modifying FROM ".TABLE_PREFIX."forums to FROM ".TABLE_PREFIX."forums f, so I decided to ask.

PHP Code:
1
2
3
4
5
6
$query = $db->query("
		SELECT *
		FROM ".TABLE_PREFIX."forums
		WHERE active != 0
		ORDER BY pid, disporder
	");

to

PHP Code:
1
2
3
4
5
6
7
$query = $db->query("
		SELECT f.*,  lp.avatar
		FROM ".TABLE_PREFIX."forums f
                LEFT JOIN ".TABLE_PREFIX."users lp ON (lp.uid=f.lastposteruid)
		WHERE active != 0
		ORDER BY pid, disporder
	");


thanks again...

(This post was last modified: 06-14-2012 07:18 AM by martec.)
06-14-2012 07:04 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Last poster avatar in forumlist - martec - 06-13-2012, 10:43 PM
RE: Last poster avatar in forumlist - martec - 06-14-2012 07:04 AM

 Standard Tools
Forum Jump: