# PHP - break from a while loop

**URL:** <https://forum.kirupa.com/t/php-break-from-a-while-loop/48576>\
**Category:** programming\
**Created:** [April 14, 2004, 7:52pm UTC](https://forum.kirupa.com/t/php-break-from-a-while-loop/48576 "2004-04-14T19:52:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![imagined](https://avatars.discourse-cdn.com/v4/letter/i/a87d85/32.png) [@imagined](https://forum.kirupa.com/u/imagined)\
**Post date:** [April 14, 2004, 7:52pm UTC](https://forum.kirupa.com/t/php-break-from-a-while-loop/48576/1 "2004-04-14T19:52:21Z")

</div>

Im making a CMS that has links that are retrieved from a database.

I have these lines in LINKS.INC  
$sql = “SELECT id, heading FROM superintendent”;  
$result = mysql\_query($sql) or die(“Couldn’t get file list”);  
while($row = mysql\_fetch\_array($result))  
{  
?\>  
\<a href="\<?php echo ($row[“id”] . “.php”); ?\>"\>\<?php echo ($row[“heading”]); ?\>\</a\>  
\<?php  
}  
?\>

If I have 10 links, it’ll show them. But i want to add an extra column to my table. Column ACTIVE. if it’s set to NO, i dont want the link to show. if its set to YES, i want the link to show. For example, let’s say  
IDs 1 through 5 are set to YES  
IDs 6 through 8 are set to NO  
IDs 9 and 10 are set to YES

How would I be able to show ONLY the links that are set to YES?
