Buying $5.00 need a quick 5 min job done!

Discussion in 'Programming' started by stefanlyl, Nov 15, 2010.

  1. #1
    Okay i have some code that displays the results of a database , i also have some code for a simple pagination script. I want them integrated....

    Take this code....
    
    	 <?
                            include('config/db_con.php');
                            mysql_connect("$host", "$username", "$password")or die("cannot connect");
                            mysql_select_db("$db_name")or die("cannot select DB");
                            $top = "SELECT * FROM `like` ORDER BY count DESC LIMIT 0, 50";
                            $new = mysql_query($top) or die(mysql_error()); 
                            while($rows = mysql_fetch_array($new)){
                            ?>
    						
    							<div class="likeareas"><fb:like layout="button_count" class="like_button" href="<? echo $site;?>like.php?like=<? echo $rows['id']; ?>"></fb:like><a href="<? echo $site;?>like.php?like=<? echo $rows['id']; ?>"><? echo stripslashes($rows['like']);?></a> </div>
    							
    						 <?
                            }
                            ?>
    
    PHP:
    And integrate it with this code..... http://biorust.com/index.php?page=tutorial_detail&tutid=103
    
    <?
    include ‘config.php’;
    if ( $_GET[‘number’] == NULL ){
    $limit = 10;
    } else {
    $limit = $_GET[‘number’];
    }
    
    if ($_GET[‘page’]==NULL){
    $start = 0;
    } else {
    $start = $_GET[‘page’];
    }
    
    // the if above, states that if the variable in the URL named page has a value, $start will be set to it, otherwise by default it is set to 0, meaning that it will start at the beginning of the table by default.
    
    if($_GET[‘page’] < 0){
    header(“Location: index.php?page=0&limit=”.$limit);
    }
    
    // this if above checks that the start variable isn’t negative, because if it is, our script will screw up. If it finds that it is, it redirects to the default page where the start is 0.
    
    $query = mysql_query(“SELECT * FROM OurTable LIMIT ‘$start’, ‘$limit’”) or die(mysql_error());
    
    // the query above now has the [a] and [b] operators incorporated, making our script paginated. All we need to do now is add the next and previous links.
    
    while ($row = mysql_fetch_array ($query) ) {
    echo ‘<p>’.$row[‘OurData’].’</p>’;
    }
    
    $previous = $start - $limit;
    $next = $start + $limit;
    echo '<a href="index.php?page='.$previous.'">Previous Page</a> - ';
    echo '<a href="index.php?page='.$next.'">Next Page</a>';
    
    // the set of statements above displays the previous and next page links
    ?>
    
    PHP:
    or if you have a better way to do it go for it....

    If you can do this , integrate it then pm me the new code and your paypal, ill plug it in , if it works ill send you the $5.00.... Ill reply to this thread once it has been completed
     
    stefanlyl, Nov 15, 2010 IP
  2. domainsurfer

    domainsurfer Well-Known Member

    Messages:
    922
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    110
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #2
    pm sent with solution.
     
    domainsurfer, Nov 15, 2010 IP
  3. stefanlyl

    stefanlyl Well-Known Member

    Messages:
    2,291
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    145
    As Seller:
    100% - 0
    As Buyer:
    100% - 1
    #3
    job completed.
     
    stefanlyl, Nov 15, 2010 IP