I have this while loop, and it is only returning the last row...

Havent experienced that before, but here it is, looks fine to me?

<?php
// NAVIGATION:
$subjectset = mysqli_query($connection, "SELECT url, link FROM subjects ORDER BY id ASC");
	while($subject = mysqli_fetch_array($subjectset)){
	$url = $subject['url'];
	$link = $subject['link'];
$navigation = '<li><a href="http://localhost/'.urlencode($url).'">'.$link.'</a></li>';
	}
?>

oops :-) works..

function navigation($connection){
$subjectset = mysqli_query($connection, "SELECT url, link FROM subjects ORDER BY id ASC");
	while($subject = mysqli_fetch_array($subjectset)){
	$url = $subject['url'];
	$link = $subject['link'];
	echo '<li><a href="http://localhost/'.urlencode($url).'">'.$link.'</a></li>';
	}
}
Be a part of the DaniWeb community

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