This should be an easy one, but I don't know how to do it myself. Basically I have an array read from an csv file to display a featured property. The problem is, if the client selects more than one property as "featured" by mistake in their property uploading software it displays every property thats featured in the array, when ideally I only want it to display one featured property on the homepage, otherwise it messes up the page. So my question is how do I limit the array to display only the first row that has the "featured" variable?
http://click-let.com/click/index.php
PHP Code:
<?php $handle = fopen("cfp/xfile.txt", "r");
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE):
$featured = $data[31];
if ($featured==FEATURED) {?>
<p><?php echo $data[2] ?></p>
<br />
<p>£<?php echo number_format($data[7], 2); ?> pcm, Rooms: <?php echo $data[8] ?></p>
<p> <a href="javascript:pop('details.php?id=<?php echo $data[1] ?>');">(more)</a></p>
<?php
}
endwhile; ?>
Bookmarks