<html>
<link rel="stylesheet" type="text/css" href="css/style.css" />

<body bgcolor="white">
<?php
	extract($_REQUEST);

	include("scripts/sqlinfo.inc");
	mysql_connect($host, $user, $pass);
	mysql_selectdb(pyrot);
	if(!$limit)
		$limit=6;
	if(!$all)
		$result=mysql_query("SELECT * from news order by datum desc, col_id desc limit $limit");
	else
		$result=mysql_query("SELECT * from news order by datum desc, col_id desc");
	if($r=mysql_fetch_array($result)){
		printf("<center><table width=400><tr><td colspan=5><span class=\"header1\">Nyheter</span>");
		do{
			printf("<tr><td><b>%s, %s</b></td></tr><tr><td>%s<hr></td></tr>",$r["datum"], $r["rubrik"], $r["info"]);
		}while($r=mysql_fetch_array($result));
		if(!$all)
			printf("<tr><td><a href=\"news.php?all=1\">Visa alla nyheter</a></td></tr></table></center>");
		else
			printf("<tr><td><a href=\"news.php?all=0\">Visa färre nyheter</a></td></tr></table></center>");
	}
	else
		printf("Databasen är tom!");
?>
</body>
</html>