Log in

View Full Version : Help with a query



fer
02-27-2011, 12:22 AM
I use the script photopost gallery and need a query to show usergroup level for the members.

I have this query


$query = "SELECT groupname FROM {$Globals['pp_db_prefix']}usergroups WHERE groupid=$usergroup";
$nomegrupo = ppmysql_query("SELECT groupname FROM {$Globals['pp_db_prefix']}usergroups WHERE groupid=$usergroup", $link);
if($nomegrupo)
{
list( $usergroup ) = mysql_fetch_row($nomegrupo);
}


This works, but have a problem!

For example if I make the login show my usergroup level [administrator] in all members. And show the same if login like a regular user. Only change the usergroup level for example show [gold] in all.

Can help me, please!

Thanks and sorry for my poor english.

james438
04-21-2011, 02:42 AM
if($nomegrupo)
{
list( $usergroup ) = mysql_fetch_row($nomegrupo);
}
is the same as

list( $usergroup ) = mysql_fetch_row($nomegrupo);

If you are trying to display all entries except where the user level is administrator try amending your queries to something like:

$nomegrupo = "SELECT groupname FROM {$Globals['pp_db_prefix']}usergroups
WHERE groupid=$usergroup AND groupid NOT LIKE '$private'";
where $private is the value you do not want pulled from the database.