Ver Mensaje Individual
  #10 (permalink)  
Antiguo 14/07/2005, 08:22
_Lobo_
 
Fecha de Ingreso: junio-2005
Mensajes: 111
Antigüedad: 18 años, 10 meses
Puntos: 0
bueno no me da ningun error, simplemete que al precionar los enlaces no cambia el orden de los datos, no se ordenan por apellido/nombre se quedan organisados por default por apellidos

codigo:
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']; 


// 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 Surname 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>

Última edición por _Lobo_; 14/07/2005 a las 08:33