0

I would like to know how can I do a LIMIT 0,10 in this case (in order to do a pagination later) because when I do this I obtain a total of 30 results (10 results for each result of the first loop) which is logical, any idea ?

$select = "SELECT X FROM Y"

$result = mysql_query($select,$link);

$total = mysql_num_rows($result);

while($row = mysql_fetch_array($result)) {

  $Name = $row['X'];
  $select2 = "SELECT id FROM `".$Name."` LIMIT 0,30 ";
  $result2 = mysql_query($select2,$link) or die ('Erreur : '.mysql_error() );
  $total2 = mysql_num_rows($result2);

  while($row2 = mysql_fetch_array($result2)) { 
     echo $row2['id']
  } 
}

Thanks in advance for your help !

4

0 回答 0