This was a bit of a while gues but it seems to work:
<?PHP
// Connect to database
$link = mysql_connect('localhost','select_user', 'password')
or die("Could not connect");
mysql_select_db('select_db')
or die("Could not select database");
//Set the Sort method for the sort=name? function - default on name
if (isset($_GET['sort']))
{
$sort = $_GET['sort'];
$area = $_GET['area'];
}
else
{
$sort = 'name';
}
//Query function ( Must be here)
$result=mysql_query("SELECT * FROM central WHERE area='$area' ORDER BY '$sort' ASC LIMIT 0, 10")
or die(mysql_error());
$singleresult=mysql_query("SELECT * FROM central WHERE area='$area' ORDER BY name ASC LIMIT 0, 10")
or die(mysql_error());
$single = mysql_fetch_assoc($singleresult);
// Content
echo '<BODY bgColor=#155271 leftMargin=0 topMargin=0 rightMargin=0 bottomMargin=0 marginwidth="0" marginheight="0" onLoad="MM_preloadImages(\'guestlistOver.jpg\',\'mapOver.jpg\',\'galleryOver.jpg\',\'commentsOver.jpg\')">
<table width="100%" height="544" border="0" cellpadding="0" cellspacing="0" id="AutoNumber7" style="border-collapse: collapse">
<tr>
<td width="380" height="544" valign="top" bordercolor="#FFFFFF">
<table width="400" height="100%" border="0" cellpadding="0" cellspacing="0" id="AutoNumber8" style="border-collapse: collapse">
<tr>
<td width="100%" valign="top"> <TABLE width="100%" border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD width="108"><img src="',$single['area'],'.gif" width="140" height="20"></TD>
<TD> <div align="right">
<p align="right"><span class=mainText>Sort by:</span> <span class="mainText">
<a href="http://www.selectguestlist.com/index/clubs.php?sort=name&area=',$single['area'],'"><IMG src=home/radio_off.gif width=10 height=10 border=0></a>
<a href="http://www.selectguestlist.com/index/clubs.php?sort=name&area=',$single['area'],'">Name</a>
<a href="http://www.selectguestlist.com/index/clubs.php?sort=rate&area=',$single['area'],'"><IMG src=home/radio_off.gif width=10 height=10 border=0></a>
<a href="http://www.selectguestlist.com/index/clubs.php?sort=rate&area=',$single['area'],'">Rating</a>
<a href="http://www.selectguestlist.com/index/clubs.php?sort=capacity&area=',$single['area'],'"><IMG src=home/radio_off.gif width=10 height=10 border=0></a>
<a href="http://www.selectguestlist.com/index/clubs.php?sort=capacity&area=',$single['area'],'">Capacity</a></span></p>
</div></TD>
<TD width="6"></TD>
</TR>
<TR>
<TD height="2" colspan="3" background="home/line.gif"></TD>
</TR>
</TBODY>
</TABLE>';
// Loop Start
while ($row=mysql_fetch_assoc($result))
{
echo '<TABLE cellSpacing=0 cellPadding=0 width="400" border=0>
<TBODY>
<TR>
<TD colSpan=2 height=6></TD>
</TR>
<TR>
<TD width=114 height="72"><img height=73 alt="" src="clubs/',$row['thumb'],'" width=109 border=0></TD>
<TD rowspan="6" vAlign=top>
<TABLE width="100%" height="173" border=0 cellPadding=0 cellSpacing=0>
<TBODY>
<TR>
<TD width=6><IMG height=8 alt="" src="home/bdr_leftcr.gif" width=6 border=0></TD>
<TD
height=6 colspan="4" background=home/bdr_top.gif></TD>
<TD width=6><IMG height=8 alt="" src="home/bdr_rightcr.gif" width=6 border=0></TD>
</TR>
<TR>
<TD width=6 height="128" rowspan="2" background="home/bdr_leftside.gif"></TD>
<TD height="127" colspan="4" vAlign=top bgColor=#0F364A class="mainText"><p>
<span class="mainTextBig">',$row['name'],'<br>
(',$row['address'],')</span><br>
<span class="mainText"><br>
',$row['description'],'</span></p>
</TD>
<TD width=6 rowspan="2" background=home/bdr_rightside.gif></TD>
</TR>
<TR>
<TD width="31" height="19" vAlign=top bgColor=#0F364A class="mainTextBig">Tube:</TD>
<TD width="105" vAlign=top bgColor=#0F364A class="mainText">',$row['tube'],'</TD>
<TD width="53" vAlign=top bgColor=#0F364A class="mainTextBig">Times:</TD>
<TD width="85" vAlign=top bgColor=#0F364A class="mainText">',$row['times'],'</TD>
</TR>
<TR>
<TD height="19" background="home/bdr_leftside.gif"><IMG height=20 alt="" src="home/bdr_leftcr_bt2.gif" width=6 border=0></TD>
<TD height="19" vAlign=top background="home/bdr_bottom.gif" bgColor=#0F364A class="mainTextBig">Tel:</TD>
<TD vAlign=top background="home/bdr_bottom.gif" bgColor=#0F364A class="mainText">',$row['tel'],'</TD>
<TD vAlign=top background="home/bdr_bottom.gif" bgColor=#0F364A class="mainTextBig">Capacity:</TD>
<TD vAlign=top background="home/bdr_bottom.gif" bgColor=#0F364A class="mainText">',$row['capacity'],'</TD>
<TD background=home/bdr_rightside.gif><IMG height=20 alt="" src="home/bdr_rightcr_bt2.gif" width=6 border=0></TD>
</TR>
</TBODY>
</TABLE>
<TABLE width="100%" border=0 align="left" cellPadding=0 cellSpacing=0>
<TBODY>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD height="20"><img src="rate/',$row['rate'],'.gif" alt="',$row['rate'],' Rating" width="109" height="20"></TD>
</TR>
<TR>
<TD height="20"><a href="',$row['guestlist'],'" target="_self" onMouseOver="MM_swapImage(\'Guestlist',$row['serial'],'\',\'\',\'guestlistOver.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="guestlist.jpg" alt="Guestlist" name="Guestlist',$row['serial'],'" width="109" height="20" border="0" id="Guestlist',$row['serial'],'"></a></TD>
</TR>
<TR>
<TD height="20"><a href="',$row['map'],'" target="_blank" onMouseOver="MM_swapImage(\'Map',$row['serial'],'\',\'\',\'mapOver.jpg\',1)" onMouseOut="MM_swapImgRestore()"><img src="map.jpg" alt="Map" name="Map',$row['serial'],'" width="109" height="20" border="0" id="Map',$row['serial'],'"></a></TD>
</TR>
<TR>
<TD height="5"><a href="',$row['gallery'],'" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Gallery',$row['serial'],'\',\'\',\'galleryOver.jpg\',1)"><img src="gallery.jpg" alt="Gallery" name="Gallery',$row['serial'],'" width="109" height="20" border="0" id="Gallery',$row['serial'],'"></a></TD>
</TR>
<TR>
<TD height="5"><a href="',$row['comments'],'" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage(\'Comments',$row['serial'],'\',\'\',\'commentsOver.jpg\',1)"><img src="comments.jpg" alt="Comments" name="Comments',$row['serial'],'" width="109" height="20" border="0" id="Comments',$row['serial'],'"></a></TD>
</TR>
<TR>
<TD height="2"></TD>
</TR>
</TBODY>
</TABLE>';
// Loop End
}
echo '</td>
</tr>
</table>
<br>
</td>
<td width="136" valign="top" bordercolor="#FFFFFF">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" width="100%" id="AutoNumber12">
<tr>
<td width="100%" align="center">';
?>
Does that look safe?
Also do you know how I can get the default to list all? :
http://www.selectguestlist.com/index/clubs.php