<?php $foo = mysql_connect("localhost","root","") or die("Could not connec to DB"); $foo = mysql_select_db("links",$foo) or die("Could not select DB"); $sql = "SELECT * FROM links"; $foo = mysql_query($sql) or die("Could not run query"); while ($foobar = mysql_fetch_array($foo)){ echo("$foobar[links] links for catid $foobar[catid]<br />");}?>