Jak wyświetlić wyniki z bazy, żeby były widoczne również nagłówki, tak żeby potem po nagłówkach można było sortować na stronie (tzn. jak klikam na hiperłącze w nagłówku to cała tabela jest sortowana właśnie po tym nagłówku)
strona gdzie jest skrypt<?php
$connection = @mysql_connect('formularz.fo.funpicsql.de', '***', '****')
$result = mysql_query("SELECT * FROM test ORDER BY distance")
header('Content-type: text/html; charset=utf-8');
echo "<table cellpadding=\"1\" border=1>"; echo "<td>".$r['name']."</td>"; echo "<td>".$r['surrname']."</td>"; echo "<td>".$r['distance']."</td>";
<a href=\"results.php?a=del&id={$r['id']}\">DEL</a>
<a href=\"results.php?a=edit&id={$r['id']}\">ADD room</a>
</td>";
}
}
if($a == 'del' and
!empty($id)) {
}
$a = trim($_REQUEST['a']);
if($a == 'edit' and
!empty($id)) {
id='$id'")
echo '<form action="results.php" method="post"> <input type="hidden" name="a" value="save" />
<input type="hidden" name="id" value="'.$id.'" />
room:<br />
<input type="text" name="room"
value="'.$r['room'].'" /><br />
<input type="submit" value="save" />
</form>';
}
}
elseif($a == 'save') {
$id = $_POST['id'];
$room = trim($_POST['room']);
room='$room' WHERE id='$id'")
}
?>