User
Pass
2FA
 
 

Afisare date fara reincarcarea paginii

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database
Author Message2180
zeuscs

[ZP.FREAKZ.RO OWNER]



Status: Offline
(since 13-10-2016 20:23)
Joined: 01 Feb 2009
Posts: 207, Topics: 30
Location: Braila

Reputation: 412.3
Votes: 12

 
Post Posted: 10-07-2011, 14:52:08 | Translate post to: ... (Click for more languages)

Am un script care imi afiseaza pe mai multe pagini niste date
Vreau sa fac sa nu mai reseteze toata pagina web cand dau sa vad alta pagina din acea lista de date...
Ca efectul cand votezi pentru server http://servere-cs.freakz.ro/lista_servere_counter-strike_1.6.html
Votez pe + si apare acea floare care se roteste.
Multumesc anticipat

0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
pax;

[Mentally Stable]



Status: Offline
(since 11-10-2011 22:52)
Joined: 04 Jul 2011
Posts: 42, Topics: 5
Location: Romania

Reputation: 124.4
Votes: 5

Post Posted: 10-07-2011, 15:00:21 | Translate post to: ... (Click for more languages)

Ca sa-ti faci o idee : http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_ajax_ajaxstart

In caz ca nu te descurci, lasi aici toate sursele de care am nevoie ca sa pot face modificarea pe care o doresti.


Humanitarianism is the expression of stupidity and cowardice.
0 0
  
Back to top
View user's profile Send private message
zeuscs

[ZP.FREAKZ.RO OWNER]



Status: Offline
(since 13-10-2016 20:23)
Joined: 01 Feb 2009
Posts: 207, Topics: 30
Location: Braila

Reputation: 412.3
Votes: 12

 
Post Posted: 10-07-2011, 16:07:05 | Translate post to: ... (Click for more languages)

Da, exact acelasi principiu il doresc
Scriptul folosit este acesta
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Papermashup.com | PHP Pagination</title>
<link href="../style.css" rel="stylesheet" type="text/css" />

<style>
.paginate {
font-family:Arial, Helvetica, sans-serif;
   padding: 3px;
   margin: 3px;
}

.paginate a {
   padding:2px 5px 2px 5px;
   margin:2px;
   border:1px solid #999;
   text-decoration:none;
   color: #666;
}
.paginate a:hover, .paginate a:active {
   border: 1px solid #999;
   color: #000;
}
.paginate span.current {
    margin: 2px;
   padding: 2px 5px 2px 5px;
      border: 1px solid #999;
      
      font-weight: bold;
      background-color: #999;
      color: #FFF;
   }
   .paginate span.disabled {
      padding:2px 5px 2px 5px;
      margin:2px;
      border:1px solid #eee;
      color:#DDD;
   }
   
   li{
      padding:4px;
      margin-bottom:3px;
      background-color:#FCC;
      list-style:none;}
      
   ul{margin:6px;
   padding:0px;}   
   
</style>
</head>

<body>

<?php include '../includes/header.php';
 $link = '| <a href="http://papermashup.com/easy-php-pagination/">Back To Tutorial</a>';
?>


<?php
   include('connect.php');   

   $tableName="countries";      
   $targetpage = "index.php";    
   $limit = 10;
   
   $query = "SELECT COUNT(*) as num FROM $tableName";
   $total_pages = mysql_fetch_array(mysql_query($query));
   $total_pages = $total_pages[num];
   
   $stages = 3;
   $page = mysql_escape_string($_GET['page']);
   if($page){
      $start = ($page - 1) * $limit;
   }else{
      $start = 0;   
      }   
   
    // Get page data
   $query1 = "SELECT * FROM $tableName LIMIT $start, $limit";
   $result = mysql_query($query1);
   
   // Initial page num setup
   if ($page == 0){$page = 1;}
   $prev = $page - 1;   
   $next = $page + 1;                     
   $lastpage = ceil($total_pages/$limit);      
   $LastPagem1 = $lastpage - 1;               
   
   
   $paginate = '';
   if($lastpage > 1)
   {   
   

   
   
      $paginate .= "<div class='paginate'>";
      // Previous
      if ($page > 1){
         $paginate.= "<a href='$targetpage?page=$prev'>previous</a>";
      }else{
         $paginate.= "<span class='disabled'>previous</span>";   }
         

      
      // Pages   
      if ($lastpage < 7 + ($stages * 2))   // Not enough pages to breaking it up
      {   
         for ($counter = 1; $counter <= $lastpage; $counter++)
         {
            if ($counter == $page){
               $paginate.= "<span class='current'>$counter</span>";
            }else{
               $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}               
         }
      }
      elseif($lastpage > 5 + ($stages * 2))   // Enough pages to hide a few?
      {
         // Beginning only hide later pages
         if($page < 1 + ($stages * 2))      
         {
            for ($counter = 1; $counter < 4 + ($stages * 2); $counter++)
            {
               if ($counter == $page){
                  $paginate.= "<span class='current'>$counter</span>";
               }else{
                  $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}               
            }
            $paginate.= "...";
            $paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
            $paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";      
         }
         // Middle hide some front and some back
         elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2))
         {
            $paginate.= "<a href='$targetpage?page=1'>1</a>";
            $paginate.= "<a href='$targetpage?page=2'>2</a>";
            $paginate.= "...";
            for ($counter = $page - $stages; $counter <= $page + $stages; $counter++)
            {
               if ($counter == $page){
                  $paginate.= "<span class='current'>$counter</span>";
               }else{
                  $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}               
            }
            $paginate.= "...";
            $paginate.= "<a href='$targetpage?page=$LastPagem1'>$LastPagem1</a>";
            $paginate.= "<a href='$targetpage?page=$lastpage'>$lastpage</a>";      
         }
         // End only hide early pages
         else
         {
            $paginate.= "<a href='$targetpage?page=1'>1</a>";
            $paginate.= "<a href='$targetpage?page=2'>2</a>";
            $paginate.= "...";
            for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++)
            {
               if ($counter == $page){
                  $paginate.= "<span class='current'>$counter</span>";
               }else{
                  $paginate.= "<a href='$targetpage?page=$counter'>$counter</a>";}               
            }
         }
      }
               
            // Next
      if ($page < $counter - 1){
         $paginate.= "<a href='$targetpage?page=$next'>next</a>";
      }else{
         $paginate.= "<span class='disabled'>next</span>";
         }
         
      $paginate.= "</div>";      
   
   
}
 echo $total_pages.' Results';
 // pagination
 echo $paginate;
?>

<ul>

<?php
 

      while($row = mysql_fetch_array($result))
      {
      
      echo '<li>'.$row['country'].'</li>';
      
      }
   
   ?>
</ul>
   
   
   
   
    <?php include '../includes/footer.php';?>

</body>
</html>

0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
Tr3z3gu3T

[Mentally Stable]



Status: Offline
(since 12-06-2019 13:16)
Joined: 29 Sep 2006
Posts: 493, Topics: 71
Location: Romania

Reputation: 481.6
Votes: 14

 
Post Posted: 10-07-2011, 16:35:10 | Translate post to: ... (Click for more languages)

hmm scapi de paginarea in php.... si o faci mai tarziu cu jquery in rest floare la ureche

http://api.jquery.com/jQuery.get/

http://plugins.jquery.com/project/pagination

0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
zeuscs

[ZP.FREAKZ.RO OWNER]



Status: Offline
(since 13-10-2016 20:23)
Joined: 01 Feb 2009
Posts: 207, Topics: 30
Location: Braila

Reputation: 412.3
Votes: 12

 
Post Posted: 10-07-2011, 22:17:06 | Translate post to: ... (Click for more languages)

Multumesc pentru raspuns.
Sa vad daca iese ceva

0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
zeuscs

[ZP.FREAKZ.RO OWNER]



Status: Offline
(since 13-10-2016 20:23)
Joined: 01 Feb 2009
Posts: 207, Topics: 30
Location: Braila

Reputation: 412.3
Votes: 12

 
Post Posted: 11-07-2011, 11:47:05 | Translate post to: ... (Click for more languages)

O problema...eu am datele in sql
Cum fac sa citesc datele din sql cu jquery?
Mie imi trebuie explicat ca la noobi

0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
Tr3z3gu3T

[Mentally Stable]



Status: Offline
(since 12-06-2019 13:16)
Joined: 29 Sep 2006
Posts: 493, Topics: 71
Location: Romania

Reputation: 481.6
Votes: 14

 
Post Posted: 11-07-2011, 15:13:58 | Translate post to: ... (Click for more languages)

https://youtube.com/watch?v=v8HoVdenZFM:




nu ai cum sa faci ceea ce ai zis tu -

Exemplu:

<body onLoad="functie ajax">

definesti functia

Code:
$.get("test.php", function(data){
$("#de_populat").html(data);
});



definesti idul ce va fi populat in html


Code:
<div id="de_populat"></div>


si divul va fi umplut cu ceea ce extragi din db prin test.php in momentul cand incarci pagina

0 0
  
Back to top
View user's profile Send private message Yahoo! Messenger ID
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Programming / Scripting / Database  


The time now is 07-02-2025, 07:56:56
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x