query
<?php
if ( $query->have_posts() ) { ?>
<?php $count = 0; ?>
<?php while ( $query->have_posts() ) {
$query->the_post();
?>
<?php $count++; ?>
<div class="orderresultholder" id="result<?php echo $count; ?>">
<table class="orderresult" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><?php the_field('style_code');?></td>
</tr>
<tr>
<td><?php $terms_as_text = strip_tags( get_the_term_list( $query->post->ID, 'sizes', '', ', ', '' ) ); echo $terms_as_text;?></td>
</tr>
<tr>
<td><?php $sellprice = get_field('selling_price', $query->ID); echo "R ".number_format($sellprice, 0);?></td>
</tr>
<tr>
<td><?php apf_post_form();?>
</td>
</tr>
<tr>
<td>
</td>
</tr>
</table>
</div>
<?php }
} else { ?>
<?php echo 'no post found'; } ?>
<?php
/* Restore original Post Data */
wp_reset_postdata();
} ?>