# While Loop

**URL:** <https://forum.kirupa.com/t/while-loop/154730>\
**Category:** programming\
**Created:** [July 12, 2005, 9:37am UTC](https://forum.kirupa.com/t/while-loop/154730 "2005-07-12T09:37:31Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![paul\_smith](https://avatars.discourse-cdn.com/v4/letter/p/8c91f0/32.png) [@paul\_smith](https://forum.kirupa.com/u/paul_smith)\
**Post date:** [July 12, 2005, 9:37am UTC](https://forum.kirupa.com/t/while-loop/154730/1 "2005-07-12T09:37:31Z")

</div>

Hi,

I have the following within some PHP code:

```php
	   // run the while loop that grabs all the sidebar links for this type
	   while($r=mysql_fetch_array($readingresult)) { 
		  
		  $id=$r["id"];
		  $lurl=$r["lurl"];
		  $ltext=$r["ltext"];
		  $ldesc=$r["ldesc"];
		 
		 // make the link for this row
		 echo "<li><a href='$lurl' target='_blank' title='Click to open link in new window'>$ltext</a> - $ldesc <strong>[<a href='deletelink.php?cmd=delete&id=$id&ltext=$ltext'>Delete</a>]</strong></li>";
		}

```

it works fine but I would like to know how I could do a “No Link of this type” message instead of it just appearing blank when there are no result from the $readingresult query.
