Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá, eu fiz a paginação certinha, ta buscando resultado tudo funcionando perfeitamente, so que quando eu mostro o resultado do banco na paginação que é feita atraves do id ele mostra do começo ao fim, sendo que quando cadastramos algo no banco ele sempre é o ultimo, nesse codigo a baixo ele mostra todos os resultados do banco sendo que eu quero que mostre do fim para o começo, pego o ultimo id e va ate o primeiro e assim mostre os resultados, segue o codigo: ------------------------------------------------------------------------------------------------------------------------------------
<?php include "topo.php".?>
<?php include "../sistema/abreconexao.php".?> <!---- Inicio da janela popup -----><script language="JavaScript">
function abrir(URL) { var width = 1070. var height = 500. var left = 99. var top = 110. window.open(URL,'janela', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no'). }
</script> <!---- fim da janela popup -----><html xmlns="[http://www.w3.org/1999/xhtml">](http://www.w3.org/1999/xhtml) <head>
<meta http-equiv="Content-Type" content="text/html. charset=utf-8" />
<title>Bueno Crédito</title> <link href="../css_sis/estilos.css" rel="stylesheet" type="text/css" />
<script src="../js/funcoes.js" type="text/javascript" /></script>
<link rel="stylesheet" href="../funcoes/modal-message/modal-message.css" type="text/css">
<script type="text/javascript" src="../js/ajax.js"></script>
<script type="text/javascript" src="../js/modal-message/modal-message.js"></script>
<script type="text/javascript" src="../js/ajax-dynamic-content.js"></script>
<script language="javascript" src="../js/mascaras.js"></script> <script type="text/javascript" src="../js/jquery-1.2.6.pack.js"></script>
<script type="text/javascript" src="../js/jquery.maskedinput-1.1.4.pack.js"/></script>
<script type="text/javascript" src="../js/scripts.js"/></script> <script type="text/javascript">
function replaceAll(str, de, para){ var pos = str.indexOf(de). while (pos > -1){
str = str.replace(de, para). pos = str.indexOf(de). } return (str). }
</script> <script>
function mudaCampo(e)if (campo.value.length == 14){
document.forms['frmCadastrar'].elements['cpfcliente'].focus(). }var tecla=(window.event)?event.keyCode:e.which. if(tecla==13) {
document.forms['frmCadastrar'].elements['cpfcliente'].focus(). return true. return false. }
} function enviaFormularioCadastro(e)if (campo.value.length == 14){
document.forms['frmCadastrar'].elements['cpfcliente'].focus(). }//alert("Envia Formulario"). var tecla=(window.event)?event.keyCode:e.which. if(tecla==13) {
//alert("tecla <E>"). chamaJanela(). //document.forms['frmCadastrar'].elements['cpfcliente'].focus(). return true. return false. }
} </script> <script type="text/javascript">
$(document).ready(function(){
$("#cpfcliente").mask("999.999.999-99"). $("#cpfcorretor").mask("999.999.999-99"). $("#dt_ini").mask("99/99/9999"). $("#dt_fim").mask("99/99/9999"). }). </script>
<script type="text/javascript" language="javascript">
function moeda(z){
v = z.value. z.value = v. }
</script>
<SCRIPT LANGUAGE="JavaScript"> <!-- from CódigoFonte.net --> <!-- Begin function checkrequired(which) { var pass1=true. var pass2=true. var pass=true. pass1 = Verifica_CPF(which.cpfcorretor.value.replace(".","").replace("-","").replace(".","")). if(!pass1){ alert("CPF do Corretor Inválido"). return false. } pass2 = Verifica_CPF(which.cpfcliente.value.replace(".","").replace("-","").replace(".","")). if(!pass2) { alert("CPF do Cliente Inválido"). return false. } if (document.images) { for (i=0. i<which.length. i++) { var tempobj=which.elements*. * //if (tempobj.name.substring(0,8)=="required") {*function Verifica_CPF(valor) {*
*var CPF = valor. //formulario.CPF.value. // Recebe o valor digitado no campo**</script>*
*<script language="javascript">*
*function chamaJanela(){**</head>*
*<body>**<table width="100%" border="0" align="center" cellpadding="0" cellspacing="2">*
* <tr>*
* <th width="436"> </th>*
* <th width="564" class="Titulo16"><strong><em><font color="#888888"> PROPOSTA/CLIENTES</font></em></strong></th>*
* </tr>*
*</table>*
*<table width="100%" border="0" align="center" cellpadding="0" cellspacing="2">*
* <tr>*
* <th width="523"> </th>*
* <th width="1127" class="Titulo16"><table width="528" cellpadding="3" cellspacing="3">*
* <tr>*
* <td width="481"><form id="frmCadastrar" name="frmCadastrar" method="post" action="cadastrar.php">*
* <div align="center">PARA CADASTRAR UMA NOVA PROPOSTA INFORME OS DADOS ABAIXO <br />*
* <br />*
* </div>*
* <label>*
* <div align="center">CPF do Corretor:*
* <input name="cpfcorretor" type="text" id="cpfcorretor" size="11" onFocus="this.style.backgroundColor='#CCFF66'" onBlur="this.style.backgroundColor='#ffffff'" onKeyPress="mudaCampo(event)" value="" />** <input name="cpfcliente" type="text" id="cpfcliente" size="11" onFocus="this.style.backgroundColor='#CCFF66'" onBlur="this.style.backgroundColor='#ffffff'" onKeyPress="enviaFormularioCadastro(event)" value=""/>*
* <!--<a href="#" onClick="displayMessage('../propostasf_corretor/cadastrar.php?id=$id_empresa','900','600'). return false" >-->*
* <button type="submit">Cadastrar</button>*
* <a href="pesquisarProposta.php"><img src="../imagens/pesquisa.PNG" width="21" height="21" alt="cadastrar novo" /></a></div>*
* </label>*
* </form></td>*
* </tr>*
* </table></th>*
* </tr>*
*</table>** <td colspan="14" align="left" class="claro" onMouseOver="this.className='ativo'. " onMouseOut="this.className='claro'. "><div align="center"></div></td>*
* </tr>*
*</table>*
* <table width="100%" border="1" cellpadding="3" cellspacing="1" align="left">*
* <tr align="left">*
* <td width="1%"> </th>*
* <td width="3%">Id</th>*
* <td width="12%">CORRETOR</th>*
* <td width="21%">CLIENTE</th>*
* <td width="7%">MUNICÃPIO</th>*
* <td width="7%">VALOR</th>*
* <td width="5%">DT CAD.</th>*
* <td width="6%">DT. APROV.</th>*
* <td width="7%">CONVÊNIO</th>*
* <td width="11%" align="left">DIGITAÇÃO</th>*
* <!--<th>LIBERAÇÃO</th>-->*
* <td width="6%">STATUS</th>*
* <td width="8%">FÃSICO</th>*
* <!--<th> DOC.S</th>-->*
* <!--<th align="center">PAGAR</th>-->*
* <!--<th>VER</th>-->*
* <td width="6%"> EXCLUIR</th>*
* </tr>**// Faz o Select pegando o registro inicial até a quantidade de registros para página*
*$sql = mysql_query("select * from propostasf WHERE tipodecontrato = 'N' ORDER BY id LIMIT $inicial, $numreg "). ** <tr class="claro" onMouseOver="this.className='ativo'. " bgcolor="#FFFFFF" onMouseOut="this.className='claro'. " align="left" >*
* <td> </td>*
* <td><a href="javascript:abrir('../propostasf/alterar.php?id=<?php echo $id.?>'). " onClick="displayMessage('../propostasf/alterar.php?id=*
* ','1000','900'). return false" title="Alterar Proposta"></a><a href="javascript:abrir('../propostasf/alterar.php?id=<?php echo $id.?>'). " onClick="displayMessage('../propostasf/alterar.php?id=*
* ','1000','900'). return false" title="Alterar Proposta"><?php echo $id.?></a></td>*
* <td><a href="javascript:abrir('../propostasf/alterar.php?id=<?php echo $id.?>'). " onClick="displayMessage('../propostasf/alterar.php?id= ','1000','900'). return false" title="Alterar Proposta"><?php echo $nome_corretor.?></a></td>*
* <td align="left"><a href="javascript:abrir('../propostasf/alterar.php?id=<?php echo $id.?>'). " onClick="displayMessage('../propostasf/alterar.php?id= ','1000','900'). return false" title="Alterar Proposta"><?php echo $nome.?></a></td>*
* <td align="left"><a href="javascript:abrir('../propostasf/alterar.php?id=<?php echo $id.?>'). " onClick="displayMessage('../propostasf/alterar.php?id= ','1000','900'). return false" title="Alterar Proposta"><?php echo $cidade.?></a></td>*
* <td align="left"><a href="javascript:abrir('../propostasf/alterar.php?id=<?php echo $id.?>'). " onClick="displayMessage('../propostasf/alterar.php?id= ','1000','900'). return false" title="Alterar Proposta"><?php echo $valorsolicitado.?></a></td>*
* <td align="left"><a href="javascript:abrir('../propostasf/alterar.php?id=<?php echo $id.?>'). " onClick="displayMessage('../propostasf/alterar.php?id= ','1000','900'). return false" title="Alterar Proposta"><?php echo $datacadastro.?></a></td>*
* <td align="left"><a href="javascript:abrir('../propostasf/alterar.php?id=<?php echo $id.?>'). " onClick="displayMessage('../propostasf/alterar.php?id= ','1000','900'). return false" title="Alterar Proposta"><?php echo $dataaprovacao.?></a></td>*
* <td align="left"><a href="javascript:abrir('../propostasf/alterar.php?id=<?php echo $id.?>'). " onClick="displayMessage('../propostasf/alterar.php?id= ','1000','900'). return false" title="Alterar Proposta">** <?php $sql2 = "SELECT * FROM convenios WHERE id = '$id_convenio' ". ** echo $nome.?></a></td> ** <td align="left" valign="middle"><a href="javascript:abrir('../propostasf/alterar.php?id=<?php echo $id.?>'). " onClick="displayMessage('../propostasf/alterar.php?id= ','1000','900'). return false" title="Alterar Proposta">** <?php $sql2 = "SELECT * FROM bancosdigitacao WHERE id = '$id_bancodigitacao' ". ** </a></td>*
* <td align="left" valign="middle"><a href="javascript:abrir('../propostasf/alterar.php?id=<?php echo $id.?>'). " onClick="displayMessage('../propostasf/alterar.php?id= ','1000','900'). return false" title="Alterar Proposta">** <?php if ($status == 'E'){ *
* echo 'EM ANALISE'. }?> *
* <?php if ($status == 'G'){ *
* echo 'AGUARDANDO'. }?> *
* <?php if ($status == 'P'){ *
* echo 'PENDENTE'. }?> *
* <?php if ($status == 'A'){ *
* echo 'APROVADO'. }?> *
* <?php if ($status == 'N'){ *
* echo 'NEGADO'. }?> *
* <?php if ($status == 'C'){ *
* echo 'CANCELADO'. }?> *
* <?php if ($status == 'S'){ *
* echo 'SACAR OP'. }?> </a></td>** <td align="left" valign="middle"><a href="javascript:abrir('../propostasf/alterar.php?id=<?php echo $id.?>'). " onClick="displayMessage('../propostasf/alterar.php?id= ','1000','900'). return false" title="Alterar Proposta">** <?php if ($fisico == 'P'){*
* echo 'PENDENTE'. }?>*
* <?php if ($fisico == 'O'){ *
* echo 'OK'. }?> </a></td>** <td align="left"></i></span><a href="../propostasf/excluir.php?id=<?php echo $id.?>"*
*onClick="return confirm('Deseja realmente deletá-lo?')"><img src="../imagens/del.png" width="20" height="20" alt="excluir" /></a></td>*
* </tr>** <tr class="claro" onMouseOver="this.className='ativo'. " onMouseOut="this.className='claro'. ">*
* <td> </td>*
* <td>TOTAL</td>*
* <td> </td>*
* <td colspan="2" align="right">*
* <td align="center"><?php *
*$sql = mysql_query("select * from propostasf WHERE tipodecontrato = 'N' ORDER BY id LIMIT $inicial, $numreg "). **echo $valorFinal.?></td>** <td align="left"> </td>*
* <td align="left"> </td>*
* <td align="left"> </td>*
* <td align="left" valign="middle"> </td>*
* <td align="left" valign="middle"> *
* <td align="left"> </td>*
* <td align="left" valign="middle"> </td>*
* </tr>** </table>*
*</form>*
*</td>*
* </tr>*
* <hr align="left" width="100%" style="border:0. border-top:1px dashed #CECBBD. height:1px. clear:both" />*
* <table width="1000" border="0">*
* <tr>*
* <td width="81"><?php $sqlC = "SELECT * FROM propostasf WHERE tipodecontrato = 'N' ". **$linha = mysql_num_rows($rsC).?></td>*
* <td width="573"><table border="0" align="right">*
* <tr>*
* <td> </td>*
* <td> </td>*
* <td> </td>*
* <td> </td>*
* </tr>*
* </table></td>*
* <td width="332"> </td>*
* </tr>*
* <tr>*
* <td align="right">Registros:*
* <?php echo $linha.?></td>*
* <td> </td>*
* <td> </td>*
* </tr>*
* </table>*
*<tr><td colspan="5"><hr color="#CCCCCC" align="center" width="100%" style="border:0. border-top:1px dashed #CECBBD. height:1px. clear:both">*
* <p>*
*<th> </th> </p></td></tr>*
*</table>*
*<table width="100%" border="0" align="center" cellpadding="0" cellspacing="2">*
* <tr>*
* </tr>*
*</table>*
*</div>**<table width="100%" border="0">*
* <tr>*
* <td colspan="15"> </td>*
* <script type="text/javascript">*
*messageObj = new DHTML_modalMessage(). // We only create one object of this class**</body>*
*</html>**if ( @$_GET['pg'] > 0) {*
*echo "<a href=".$_SERVER['PHP_SELF']."?pg=".(@$_GET['pg']-1)." class=pg ><b>« Anterior</b></a>". **if (@$_GET['pg'] == ($i_pg-1)) {*
*echo " <span class=pgoff>[$i_pg]</span> ". **echo " <a href=".$_SERVER['PHP_SELF']."?pg=$i_pg2 class=pg><b>$i_pg</b></a> ". **if ((@$_GET['pg']+2) < $quant_pg) {*
*echo "<a href=".$_SERVER['PHP_SELF']."?pg=".(@$_GET['pg']+1)." class=pg ><b>próximo »</b></a>". *Carregando comentários...