Jump to content

[SOLVED] Multiple Query Error


steveangelis

Recommended Posts

<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30" align="center" valign="middle"><table width="100%" border="1" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center" valign="middle" background="styles/<?PHP echo $cfgcontent['style']; ?>/images/ranks_top.gif" height='30'><span class="style3">Members</span></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td align="left" valign="top"> </td>
  </tr>
  <tr>
    <td align="left" valign="top"><?PHP
$queryrnk1 = "SELECT * FROM ranks order by rnk_order asc";
$resultrnk1 = mysql_query($queryrnk1) or die("$query does not make any sence;<br>" . mysql_error());
if 
(mysql_numrows($resultrnk1)>0)
{
for($n=0;$n<mysql_numrows($resultrnk1);$n++) 
{
$rnk1content = mysql_fetch_array($resultrnk1); 
$rank_id = $rnk1content['id'];
?><table width="100%" border="0">
  <tr>
    <td align="center" valign="top" class="style4"><?PHP echo $rnk1content['rnk_name'];?></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="left" valign="top" class="style4">Rank</td>
        <td align="left" valign="top">Name</td>
        <td align="left" valign="top">Primary Game</td>
        <td align="left" valign="top">Active</td>
      </tr>
          <?PHP
$queryrnk2 = "SELECT * FROM members where mbr_rank='$rank_id' order by mbr_name asc";
$resultrnk2 = mysql_query($queryrnk2) or die("$query does not make any sence;<br>" . mysql_error());
if 
(mysql_numrows($resultrnk2)>0)
{
for($n=0;$n<mysql_numrows($resultrnk2);$n++) 
{
$rnk2content = mysql_fetch_array($resultrnk2); 
?><tr>
            <td width="150" align="left" valign="top" class="style4"><img src="<?PHP echo $rnk1content ['rnk_image']; ?>" alt="<?PHP echo $rnk1content ['rnk_name']; ?>"></td>
            <td align="left" valign="top"><a href="index.php?p=profiles&id=<?PHP echo $rnk2content ['id']; ?>"><?PHP echo $rnk2content ['mbr_name']; ?></a><br></td>
            <td align="left" valign="top"><?PHP echo $rnk2content ['mbr_gameprimary']; ?></td>
            <td align="left" valign="top"><?PHP echo $rnk2content ['mbr_status']; ?></td>
          </tr>
    <?PHP 
} 
} 
?>
        </table>
        </td>
  </tr>
</table>
        <hr width="100%">
      <?PHP 
} 
} 
?>
    </td>
  </tr>
</table>

 

This code is not too complicated.  What it is susposed to do is first of all get all the ranks in the database and order them by a field rnk_order until there are no more ranks.  Next with each rank it is to show all the members with that rank.  It shows all the members from the first rank but it not going onto the next rank and I know there is more than one rank in the database.  Can anyone see where I am going wrong?  It does now show any other rank except the first.

Link to comment
Share on other sites

<?PHP

$queryrnk1 = "SELECT * FROM ranks order by rnk_order asc";

$resultrnk1 = mysql_query($queryrnk1) or die("$query does not make any sence;<br>" . mysql_error());

if

(mysql_numrows($resultrnk1)>0)

{

for($n=0;$n<mysql_numrows($resultrnk1);$n++)

{

$rnk1content = mysql_fetch_array($resultrnk1);

$rank_id = $rnk1content['id'];

?>

 

That is where the error is happening and I do not see the problem.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.