Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2006
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Prev - Next Help

    hi
    i need help to add button or picture Prev and Next, in my script i just have show prev or next whit numbers, someone help me to add button or picture for prev or next ?

    PHP Code:
    <?
    if(empty($_GET[Start]))
    {
        
    $Start '0';
    }
    else
    {
        
    $Start $_GET[Start];
    }

    $ByPage '10';

    //show the catalog content
    $q1 "select ItemID, ItemName from bsoft_catalog order by ItemName limit $Start, $ByPage";
    $r1 mysql_query($q1) or die(mysql_error());

    if(
    mysql_num_rows($r1) > '0')
    {
        
    ?>
        <table align=center width=400 cellspacing=0>
        <tr class=TableHead>
            <td width=300>Product</td>
            <td width=100 align=center>Action</td>
        </tr>

        <?
        
        $col 
    "white";

        while(
    $a1 mysql_fetch_array($r1))
        {
            if(
    $col == "white")
            {
                
    $col "dddddd";
            }
            else
            {
                
    $col "white";
            }

            echo 
    "<tr bgcolor=\"$col\">\n\t<td><a href=\"view_item.php?ItemID=$a1[ItemID]\" class=Nav>$a1[ItemName]</a></td>\n<td align=center><a class=GreenLink href=\"edit_item.php?ItemID=$a1[ItemID]\">izmeni</a> | <a href=\"delete_item.php?ItemID=$a1[ItemID]\" class=RedLink OnClick=\"return cdel('$a1[ItemName]');\">brisi</a></td>\n</tr>\n\n";
        }
        
        echo 
    "</table>";

        
    $qnav "select count(*) from bsoft_catalog";
        
    $rnav mysql_query($qnav) or die(mysql_error());
        
    $anav mysql_fetch_array($rnav);
        
    $rows $anav[0];

        if(
    $rows $ByPage)
        {
                
    $NextPrev =  "<br><table align=center width=400><tr>";
                
    $NextPrev .= "<td align=center class=Nav> | ";

                
    $pages ceil($rows/$ByPage);

                for(
    $i 0$i <= ($pages); $i++)
                {
                    
    $PageStart $ByPage*$i;

                    
    $i2 $i 1;

                    if(
    $PageStart == $Start)
                    {
                        
    $links[] = " <span class=RedLink>$i2</span>\n\t ";
                    }
                    elseif(
    $PageStart $rows)
                    {
                        
    $links[] = " <a class=Nav href=\"catalog.php?Start=$PageStart\">$i2</a>\n\t ";    
                    }
                }

                
    $links2 implode(" | "$links);
            
                
    $NextPrev .= $links2;

                
    $NextPrev .=  "| </td>";

                
    $NextPrev .= "</tr></table><br>\n";

                echo 
    $NextPrev;
        }

    }

    include 
    "footer.php";

    ?>

  • #2
    New to the CF scene
    Join Date
    Feb 2007
    Location
    Lahore, Pakistan
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would recomend you the javascript previous next option, it better then php and works perfectly fine... let me know if you need that

  • #3
    New Coder
    Join Date
    Oct 2006
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if you know php code for prev and next please write here, in my code just show numbers of page, i need now add TEXT prev - next and stay numbers of page ...


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •