note 38015 added to function.mssql-data-seek
| From: | andre dot listas at infolink dot com dot br | Date: | Thu, 04 Dec 2003 16:37:28 +0000 |
| Subject: | note 38015 added to function.mssql-data-seek | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-61412@lists.php.net to get a copy of this message | ||
Estou postando a nível de manter uma cópia on-line o script php de paginação de resultados
utilizando a função mssql_data_seek em substituição do limit que temos no mysql. Também conto
com a colaboração de todos para updates e melhorias deste script.
I am posting the level to keep a copy on-line script php of paging of results using the function
mssql_data_seek in substitution of limit that we have in mysql. Also story with the contribution of
all for updates and improvements of this script.
<!-- //Query e tratamento -->
<?
if(empty($_GET['p'])){$Pagina = "1";}else{$Pagina = $_GET['p'];}
$SQL="";
$ConsultaSQL = mssql_query($SQL);
$RegPP = 10;
$ContaReg = mssql_num_rows($ConsultaSQL);
$Total = ceil($ContaReg / $RegPP);
if( empty($Pagina) ) {
$inicio = 0;
} else {
$inicio = (($Pagina -1) * $RegPP);
}
if ($ContaReg <> 0) {
$RegIni = mssql_data_seek($ConsultaSQL, $inicio);
}
?>
<!-- // Controle de links para navagação entre as páginas -->
<?
if($Pagina > 1) {
$menos = $Pagina - 1;
$url = $_SERVER['PHP_SELF']."?p=".$menos;
echo "<a href=".$url."
class='TextoAvisos'>«</a>";
}
?>
<span class="TextoDados"><? echo $Pagina; ?></span> de <span
class="TextoDados"><? echo $Total; ?></span>
<?
if($Pagina < $Total) {
$mais = $Pagina + 1;
$url = $_SERVER['PHP_SELF']."?p=".$mais;
echo "<a href=".$url."
class='TextoAvisos'>»</a>";
}
?>
<!-- //Mostrando os dados dentro do while -->
<?
$MaxExibe = ($RegPP + 1);
$Ocorrencia = 0;
while ( $registro = mssql_fetch_array($ConsultaSQL)){
$Ocorrencia++;
if ($Ocorrencia < $MaxExibe) {
?>
<table ....
blabla ...resulbusca....
.../table>
<?
}//Fecha if ($Ocorrencia < $MaxExibe)
}//Fecha while
?>
<!-- // Controle de links para navagação entre as páginas -->
<?
if($Pagina > 1) {
$menos = $Pagina - 1;
$url = $_SERVER['PHP_SELF']."?result=3&p=".$menos;
echo "<a href=".$url."
class='TextoAvisos'>«</a>";
}
?>
<span class="TextoDados"><? echo $Pagina; ?></span> de <span
class="TextoDados"><? echo $Total; ?></span>
<?
if($Pagina < $Total) {
$mais = $Pagina + 1;
$url = $_SERVER['PHP_SELF']."?result=3&p=".$mais;
echo "<a href=".$url."
class='TextoAvisos'>»</a>";
}
?>
André de Abreu - Rio de Janeiro - Brasil
04/12/2003 - ICQ#85785655
----
Manual Page -- http://www.php.net/manual/en/function.mssql-data-seek.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+38015
Delete -- http://master.php.net/manage/user-notes.php?action=delete+38015&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+38015&report=yes
Search -- http://master.php.net/manage/user-notes.php