<?php function CreateDBnav( $from ) { global $limit,$offset,$conexion,$nav_buttons,$parse_options; $qrows = "SELECT DISTINCT * FROM $from"; $res = mysql_query( $qrows, $conexion ) or die("No puedo obtener el número de registros<br>".mysql_error($conexion)); $numrows = mysql_num_rows( $res ); $nav_buttons = "<table border=\"0\" cellpadding=\"2\" cellspacing=\"0\" width=\"100%\"><tr><td width=\"100%\"><p style=\"text-align:right\">"; if ( $offset > 1 ) $nav_buttons .= "<a href=\"$PHP_SELF?offset=".($offset-$limit)."$parse_options\"><< Anterior</a> -"; else $nav_buttons .= "<< Anterior -"; if ( $numrows > 0 ) { $pages = intval( $numrows/$limit ); if ( $numrows%$limit ) $pages++; for ( $i=1;$i<=$pages;$i++) { $newoffset=$limit*($i-1); if ( $newoffset == $offset ) $nav_buttons .= "[$i]-"; else $nav_buttons .= "<a href=\"$PHP_SELF?offset=$newoffset$parse_options\">$i</a>-"; } } $nav_buttons .= "</p></td><td><nobr>"; if ( ($offset+$limit)<$numrows ) $nav_buttons .= "<a href=\"$PHP_SELF?offset=".($offset+$limit)."$parse_options\">Siguiente >></a>"; else $nav_buttons .= "Siguiente >>"; $nav_buttons .= "</nobr></td></tr></table>"; }; function ShowDBnav() { global $nav_buttons; echo $nav_buttons; }; function GetDBnav() { global $nav_buttons; return $nav_buttons; };