Steve Angelis Posted May 30, 2008 Share Posted May 30, 2008 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 More sharing options...
Steve Angelis Posted May 30, 2008 Author Share Posted May 30, 2008 Never mind I figured it out Link to comment https://forums.phpfreaks.com/topic/107907-solved-multiple-queries/#findComment-553127 Share on other sites More sharing options...
monkeypaw201 Posted May 30, 2008 Share Posted May 30, 2008 Care posting it for other people who may encounter the same issue? Link to comment https://forums.phpfreaks.com/topic/107907-solved-multiple-queries/#findComment-553128 Share on other sites More sharing options...
Steve Angelis Posted May 30, 2008 Author Share Posted May 30, 2008 user_rank=1 had to be changed to reflect the rank changing Link to comment https://forums.phpfreaks.com/topic/107907-solved-multiple-queries/#findComment-553210 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.