Hello all,

I've been searching all day for a solution to this. I have the following code:

<?php foreach ($software_serialRecords as $record): ?>

<?php $programLimit = array(); ?>
<?php $programLimit[] = $record['program']; ?>
<?php $programLimit = array_unique($programLimit); ?>

<?php for ($i = 0; $i<count($programLimit); $i++) { ?>

<option value="software_serials_program.php?program=<?php echo $record['program'] ?>"><?php echo ($programLimit[$i]) ?></option> 
<?php $maxCols=1; if (@++$count % $maxCols == 0): ?> 
<?php endif; ?>

<?php ;} ?>

<?php endforeach ?>

I can get the drop down to display the "programs" i need, but it keeps ignoring the "array_unique" command. I read somewhere that sometimes the loops don't like "echo" so I tried "print_r" but still no difference. I also tried using "foreach" instead of the "for" loop, but same results.

Any ideas??


Recommended Answers

All 2 Replies

Try to define <?php $programLimit = array(); ?> before the foreach loop, bye.

Sorry still nothing. Putting that line outside the foreach loop either returns no value or the value keeps saying "Array" over and over again...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.