Как да разделя класацията на 2?

4isto_lyd

Registered
Здравейте, може ли да ми кажете как м0га да разделя класцията на две (момичета, момчета)
с този код разоплагам:
Код:
<?php 
$page=$_GET['page'];
$limit = 16;
$limit1 = $page * $limit;
$num = (($page * 16) + 1);
$i = 1;
$q = "SELECT * FROM `users` ORDER by `points` DESC LIMIT $limit1, $limit";
$result = $database->query($q);
$num_rows = mysql_numrows($result);
if(!$result || ($num_rows < 0)){
   echo "Error displaying info";
}
else if($num_rows > 0){
   for($i=0; $i<$num_rows; $i++){
      $uname = mysql_result($result,$i,"username");
      $pic = mysql_result($result,$i,"pic");
      $sex = mysql_result($result,$i,"sex");
      $points = mysql_result($result,$i,"points");
      if($sex=='m') {
	  ?>
<td valign="top" id="pos"><?php echo $num; ?></td><td><a href="userinfo.php?user=<?php echo $uname; ?>"><img src="<?php echo $pic;?>" width="130" height="158" style="border:2px solid #13B1E1;"></a><br><center>
<font color="#13b1e1" size="2"><?php echo $uname; ?></font>
<font color="#777777"> (<?php echo $points; ?> гласа)</font></center></td>
<?php } else { ?>
<td  valign="top" id="pos"><?php echo $num; ?></td><td><a href="userinfo.php?user=<?php echo $uname; ?>"><img src="<?php echo $pic;?>" width="130" height="158" style="border:2px solid #E22BAB;"></a><br><center>
<font color="#E22BAB" size="2"><?php echo $uname; ?></font>
<font color="#777777"> (<?php echo $points; ?> гласа)</font></center></td>
<?php } if($i==3 or $i==7 or $i==11) { echo "</tr><tr>"; }
$num = $num + 1;
   }
}
?>
 
Код:
<?php 
$page=$_GET['page']; 
$limit = 16; 
$limit1 = $page * $limit; 
$num = (($page * 16) + 1); 
$i = 1; 
$q = "SELECT * FROM `users` WHERE sex='[color=red]ЗА–МЪЖ[/color]' ORDER by `points` DESC LIMIT $limit1, $limit"; 
$result = $database->query($q); 
$num_rows = mysql_numrows($result); 
if(!$result || ($num_rows < 0)){ 
   echo "Error displaying info"; 
} 
else if($num_rows > 0){ 
   for($i=0; $i<$num_rows; $i++){ 
      $uname = mysql_result($result,$i,"username"); 
      $pic = mysql_result($result,$i,"pic"); 
      $sex = mysql_result($result,$i,"sex"); 
      $points = mysql_result($result,$i,"points"); 
      if($sex=='m') { 
     ?> 
<td valign="top" id="pos"><?php echo $num; ?></td><td><a href="userinfo.php?user=<?php echo $uname; ?>"><img src="<?php echo $pic;?>" width="130" height="158" style="border:2px solid #13B1E1;"></a><br><center> 
<font color="#13b1e1" size="2"><?php echo $uname; ?></font> 
<font color="#777777"> (<?php echo $points; ?> гласа)</font></center></td> 
<?php } else { ?> 
<td  valign="top" id="pos"><?php echo $num; ?></td><td><a href="userinfo.php?user=<?php echo $uname; ?>"><img src="<?php echo $pic;?>" width="130" height="158" style="border:2px solid #E22BAB;"></a><br><center> 
<font color="#E22BAB" size="2"><?php echo $uname; ?></font> 
<font color="#777777"> (<?php echo $points; ?> гласа)</font></center></td> 
<?php } if($i==3 or $i==7 or $i==11) { echo "</tr><tr>"; } 
$num = $num + 1; 
   } 
} 
$i = 1; 
$q = "SELECT * FROM `users` WHERE sex='[color=red]ЗА–ЖЕНА[/color]' ORDER by `points` DESC LIMIT $limit1, $limit"; 
$result = $database->query($q); 
$num_rows = mysql_numrows($result); 
if(!$result || ($num_rows < 0)){ 
   echo "Error displaying info"; 
} 
else if($num_rows > 0){ 
   for($i=0; $i<$num_rows; $i++){ 
      $uname = mysql_result($result,$i,"username"); 
      $pic = mysql_result($result,$i,"pic"); 
      $sex = mysql_result($result,$i,"sex"); 
      $points = mysql_result($result,$i,"points"); 
      if($sex=='m') { 
     ?> 
<td valign="top" id="pos"><?php echo $num; ?></td><td><a href="userinfo.php?user=<?php echo $uname; ?>"><img src="<?php echo $pic;?>" width="130" height="158" style="border:2px solid #13B1E1;"></a><br><center> 
<font color="#13b1e1" size="2"><?php echo $uname; ?></font> 
<font color="#777777"> (<?php echo $points; ?> гласа)</font></center></td> 
<?php } else { ?> 
<td  valign="top" id="pos"><?php echo $num; ?></td><td><a href="userinfo.php?user=<?php echo $uname; ?>"><img src="<?php echo $pic;?>" width="130" height="158" style="border:2px solid #E22BAB;"></a><br><center> 
<font color="#E22BAB" size="2"><?php echo $uname; ?></font> 
<font color="#777777"> (<?php echo $points; ?> гласа)</font></center></td> 
<?php } if($i==3 or $i==7 or $i==11) { echo "</tr><tr>"; } 
$num = $num + 1; 
   } 
} 
?>
 

Back
Горе