I make a for statement and in that statement I make a new query where I fetch all individuals in each class and sort them by id.
Each member in each class should be printed into a file, limited by 15, if there is more than 15 the rest should be printed to the next file.
My logic is a little confusing to me...
Code: Select all
$queryorder = "SELECT *
FROM mytable
GROUP BY class ORDER BY cat_order";
count $rows1...
for ($ii = 0; $ii < $rows1; $ii++)
{
$query = "SELECT *
FROM mytable
WHERE class = '". $rows1[$ii]['class'] . "'
ORDER BY id";
$rows2
$count = 1;
$sid_nr = 1;
$list_nr = 1;
for ($iii = 0; $iii < $rows2; $iii++)
{
if($count == 1)
{
createnewfile
$ring = $rows2[$iii]['ring'];
}
for($count_i = 1; $count_i < 16; $count_i++):
if($rows2[$iii]['C'] == 1){$rows2[$iii]['C'] = 'C';}else{$rows2[$iii]['C'] = '';}
if($rows2[$iii]['S'] == 1){$rows2[$iii]['S'] = 'S';}else{$rows2[$iii]['S'] = '';}
if($count_i == $count)
{
variabel1='VAR1'.$count_i, $rows2[$iii]['nr']);
variabel2='CS'.$count_i, $rows2[$iii]['C'] . $rows2[$iii]['S']);
variabel3='NAME'.$count_i, $rows2[$iii]['id_nr'] . ' ' . $rows2[$iii]['name']);
}
endfor;
$count++;
if($count == 15)
{
$filename = somefilename;
$myFile = $resultiddir.DS.$filename;
closefile
$count = 1;
$sid_nr++;
}
if($count == $rows2
{
$filename = somefilename;
$myFile = $resultiddir.DS.$filename;
closefile
$count = 1;
$sid_nr = 1;
}
}
}