как да разделя

niksdevil

Registered
Как да разделя мъжете и жените в 2 колонки ?
Код:
<?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:
 $q = "SELECT * FROM `users` where `pol`='myze' ORDER by `points` DESC LIMIT $limit1, $limit";

ето и за жените
PHP:
 $q = "SELECT * FROM `users` where `pol`='zemi' ORDER by `points` DESC LIMIT $limit1, $limit";
 

Back
Горе