Hola de nuevo, en esta línea de tu código
Código PHP:
$sql = mysql_query("SELECT * FROM tbl_instructores ORDER BY Surname ASC LIMIT $from, $max_results");
repites el query, aquí es donde debes sutituir "Surname" x "$orden"
Código PHP:
$sql = mysql_query("SELECT * FROM tbl_instructores ORDER BY $orden ASC LIMIT $from, $max_results");
con ello te quedaría:
Código PHP:
<?php require_once('../../Connections/conn_newland.php'); ?>
<?php
mysql_select_db($database_conn_newland, $conn_newland);
$query_rs_countries = "SELECT ID, Surname FROM tbl_instructores ORDER BY Surname ASC";
$rs_countries = mysql_query($query_rs_countries);
$row_rs_countries = mysql_fetch_assoc($rs_countries);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<?php
// Database Connection
mysql_select_db('newland_tours', mysql_pconnect('localhost','root','root')) or die (mysql_error());
// If current page number, use it
// if not, set one!
if(!isset($_GET['page'])){
$page = 1;
} else {
$page = $_GET['page'];
}
$orden=$_GET['orden'];
// Comprobamos que la variable no esta vacia, y si lo esta le damos el valor predeterminado, en este caso Surname.
if (empty($orden)) { $orden="Surname"; } // se ordenará por apellido
// Define the number of results per page
$max_results = 50;
// Figure out the limit for the query based
// on the current page number.
$from = (($page * $max_results) - $max_results);
// Perform MySQL query on only the current page number's results
$sql = mysql_query("SELECT * FROM tbl_instructores ORDER BY $orden ASC LIMIT $from, $max_results");
while($row_rs_countries = mysql_fetch_array($sql)){
// Meter los datos que se desean paginar
//echo $row_rs_countries["Surname"]. " <b>ID:</b> " . $row_rs_countries['ID'] ." | ". ' <a href="instructores_update.php?ID='.$row_rs_countries["ID"].'">Modify this countrys profile</a> '." | ".'<a href="delete_processor.php?ID='.$row_rs_countries['ID'].'">Delete</a>'."<br />";
echo " <b>Surname:</b> ".$row_rs_countries["Surname"]. " <b>Firstname:</b> " . $row_rs_countries['Firstname'] ." | ".' <a href="instructores_update.php?ID='.$row_rs_countries["ID"].'">Modify current profile</a> '." | ". ' <a href="instructores_insert.php">Add new profile</a> '." | ".'<a href="delete_processor.php?ID='.$row_rs_countries['ID'].'">Delete current profile</a>'."<br />";
}
// Figure out the total number of results in DB:
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM tbl_instructores"),0);
// Figure out the total number of pages. Always round up using ceil()
$total_pages = ceil($total_results / $max_results);
// Build Page Number Hyperlinks
echo "<center>Select a Page<br />";
// Build Previous Link
if($page > 1){
$prev = ($page - 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\"><<Previous</a> ";
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}
// Build Next Link
if($page < $total_pages){
$next = ($page + 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\">Next>></a>";
}
echo "</center>";
?>
Alright, it looks like I have some explaining to do! Let's break the code
</body>
</html>
Creo que así debería funcionarte, colocando los enlaces donde tu quieras
Un saludo