Jump to content

[SOLVED] Multiple Queries


Steve Angelis

Recommended Posts

I have a code, all done on a single page, that calls up data from a query.  Nothing wrong here in fact that works perfectly.  It is part of an if statement:

 

if ($rankset == 'adm')
{
$queryrk = "SELECT rank_id, rank_title, rank_image FROM phpbb_ranks where rank_id=1";
$resultrk = mysql_query($queryrk) or die("$query does not make any sence;<br>" . mysql_error());
$contentrk = mysql_fetch_array($resultrk);

$query = "SELECT user_id, username, user_rank FROM phpbb_users where user_rank='1' order by username ASC";
$result = mysql_query($query) or die("$query does not make any sence;<br>" . mysql_error());

All of this works out fine, it does what it susposed to no problems.  After this is done, it closes off the if statement with an elseif and goes onto the next rank and so on through all of them.  The problem is this.  It shows the correct ranks image for each part, but for each time it shows a rank, it shows up the first name only.  The first rank only has one name attached to it so that is why only one shows up, but when it moves to the next rank, if there are no members it is susposed to skip it.  I know the problem lies in telling the code to stop using the first member query, this one:

 

$query = "SELECT user_id, username, user_rank FROM phpbb_users where user_rank='1' order by username ASC";
$result = mysql_query($query) or die("$query does not make any sence;<br>" . mysql_error());

The problem is how do I get it to each time, to use the correct query instead of the first one short of changing the name of $query and $result each time?

Link to comment
https://forums.phpfreaks.com/topic/107907-solved-multiple-queries/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.