Simple Machines Community Forum

General Community => Scripting Help => Topic started by: BlindProphet on October 15, 2006, 10:11:55 AM

Title: Dynamic Avatar, help needed
Post by: BlindProphet on October 15, 2006, 10:11:55 AM
Okay, heres the situation:
I'm trying to create a Dynamic Forum Avatar (I believe VB had those).
The first version is going to be requested by the used ID, unless you guys can help me fully integrate it into SMF.
So $_GET gets the user ID, and retrieves memberName and prints it on the avatar.

What I need help with, is the correct MYSQL query needed to retrieve the info from the database.

Thanks in advance!  ;)
Title: Re: Dynamic Avatar, help needed
Post by: Oldiesmann on October 15, 2006, 06:42:06 PM
SELECT IFNULL(realName, memberName) AS name FROM {$db_prefix}members WHERE ID_MEMBER = '$_GET[id]';

That's the basic query - the IFNULL part is important - it will pull the display name if it's set, otherwise it pulls their user name. Make sure you take the basic security precautions such as ensuring that the id is set and that it's an integer.
Title: Re: Dynamic Avatar, help needed
Post by: BlindProphet on October 16, 2006, 03:00:08 PM
Thanks dude! I'll try it asap.