0

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>';
	}
?>
1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by klemme
0

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>';
	}
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.