lundi 2 novembre 2015

MySQL Order By Rand() gives 1 result not 24

I want to display 24 unique id's but he is only giving me 1: This is my php

    <?php $sql = "SELECT id 
                          FROM 15players 
                          ORDER BY RAND() 
                          LIMIT 24";    $result = mysql_query($sql) or die('Query failed: ' . mysql_error());        
$row = mysql_fetch_array($result);
echo $row['id'];         ?>

But if I execute this SQL in phpmyadmin, It returns me 24 id's So what am I doing wrong?




Aucun commentaire:

Enregistrer un commentaire