Location: PHPKode > projects > HypatiaDB > hypatiadb/view-favourites.php
<?php
include("common_db.php");
include("functions.php");
dbconnect($host, $username, $password); //from common_db.php
$strings = loadStrings($lang, 'VFAV');
headers();
html();
head($strings['VFAV_TITLE']);
menu();
navpane();
?>
	<div id="mainpane">
		<?php 
//List the current favourites
$uname = mysql_escape_string($_SESSION['session_user']);
$query = "SELECT id, name FROM favourites WHERE username = '$uname'";
$qr = mysql_query($query);
if(mysql_num_rows($qr) == 0) {
	//they have no favourites
	echo("<p>$strings[VFAV_NOFAVS]</p>");
} else {
	echo('<ul>');
	while($fav = mysql_fetch_array($qr)) {
		echo("<li><a href=\"/show-favourite?id=$fav[id]\">$fav[name]</a></li>");
	}
	echo('</ul>');
}
		?>
	</div>
<?php
endhtml();
?>
Return current item: HypatiaDB