Jump to content

piet bierbuik

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Posts posted by piet bierbuik

  1. yes it worked thx you sasa.
    i thought $i++ is the same as $i+1, but now it works so im happy.

    here is the full code:

    [code]<?php
    include ("connect.php");

    $limit = 5;   
    $query_count = "SELECT * FROM table";
    $result_count  = mysql_query($query_count);       
    $totalrows  = mysql_num_rows($result_count);   
    $page = $_GET['page'];

    if(empty($page))

            $page = 1;   
        }
    $limitvalue = $page * $limit - ($limit); 
    $query  = "SELECT * FROM table LIMIT $limitvalue, $limit";       
    $result = mysql_query($query) or die("Error: " . mysql_error()); 

    if(mysql_num_rows($result) == 0)
    {
            echo("Nothing to Display!");
        }

    while ($rij = mysql_fetch_array ($result))
    {
    echo $rij['naam'],"</BR>";
    }

    if($page != 1)

    $pageprev = $page-1;
    echo("<a href=\"$_SERVER[PHP_SELF]?page=$pageprev\">PREV".$limit."</a> ");   
    }
    else
    {
    echo("PREV".$limit." "); 
    }

    $numofpages = $totalrows / $limit; 

    for($i = 1; $i <= $numofpages; $i++)
    {
    if($i == $page)
    {
    echo($i." ");
    }
    else
    {
                echo("<a href=\"$_SERVER[PHP_SELF]?page=$i\">$i</a> ");
            }
           
    }


    if(($totalrows % $limit) != 0)
    {     
    if($i == $page)
    {
    echo($i." ");
    }
    else
    {
    echo("<a href=\"$_SERVER[PHP_SELF]?page=$i\">$i</a> ");
    }
    }

    if(($totalrows - ($limit * $page)) > 0)
    {
    $pagenext = $page+1;
    echo("<a href=\"$_SERVER[PHP_SELF]?page=$pagenext\">NEXT".$limit."</a>");
    }

    else
    {
    echo("NEXT".$limit);
    }

    ?>

    [/code]
  2. hi,

    i've created a pagination script and it works... half, not like i want.
    http://84.244.181.93/~vandenberg/onlinetilburg/pagenation.php
    1. the PREV button doesn't work.
    2. if i press like same number 10, the numbering say its on page 11.

    can someone help me alternate this file.

    oops, sorry

    [code]
    <?php
    include ("connect.php");

    $limit = 5;   
    $query_count = "SELECT * FROM uitgaan";   
        // count(*) is better for large databases (thanks Greg!)
    $result_count  = mysql_query($query_count);       
    $totalrows  = mysql_num_rows($result_count);   
    $page = $_GET['page'];

    if(empty($page))

            $page = 1;   
        }
    $limitvalue = $page * $limit - ($limit);
    echo "<br>";
    echo "-----------------------------------------";
    echo "<br>";
    echo '$page=', $page;
    echo "<br>";
    echo '$limitvalue=',$limitvalue;
    echo "<br>";
    echo "-----------------------------------------";
    echo "<br>";
    echo "<br>";
     
    $query  = "SELECT * FROM uitgaan LIMIT $limitvalue, $limit";       
    $result = mysql_query($query) or die("Error: " . mysql_error()); 

    if(mysql_num_rows($result) == 0)
    {
            echo("Nothing to Display!");
        }

    while ($rij = mysql_fetch_array ($result))
    {
    echo $rij['naam'],"</BR>";
    }

    if($page != 1)

    $pageprev = $page++;
    echo("<a href=\"$_SERVER[PHP_SELF]?page=$pageprev\">PREV".$limit."</a> ");   
    }
    else
    {
    echo("PREV".$limit." "); 
    }

    $numofpages = $totalrows / $limit; 

    for($i = 1; $i <= $numofpages; $i++)
    {
    if($i == $page)
    {
    echo($i." ");
    }
    else
    {
                echo("<a href=\"$_SERVER[PHP_SELF]?page=$i\">$i</a> ");
            }
           
    }


    if(($totalrows % $limit) != 0)
    {     
    if($i == $page)
    {
    echo($i." ");
    }
    else
    {
    echo("<a href=\"$_SERVER[PHP_SELF]?page=$i\">$i</a> ");
    }
    }

    if(($totalrows - ($limit * $page)) > 0)
    {
    $pagenext  = $page--;
    echo("<a href=\"$_SERVER[PHP_SELF]?page=$pagenext\">NEXT".$limit."</a>");
    }

    else
    {
    echo("NEXT".$limit);
    }

    ?>
    [/code]
  3. thats not working,
    when i open all.php (frameset) it opens left.php and right.php. but right.php is redirected to all.php.
    so now it will redirect all the time to all.php so it loops and give's me constant all.php
  4. hi i work in frames.
    i have all.php, left.php and right.php

    i want people to stay on all.php
    so if they go to: www.mydomain.com/left.php they get redirected(or blocked) to all.php

    is this possible ?(i hope it can be done with php other options are welcome)
  5. hi people

    i have a script that retrieve all names form the database
    but the list is getting to big (over 40)


    i would like to create a page that splits up those 40 results.
    so after 10 results you can click next to the next 10 results.

    can someone modify this script for me

    THX piet

    [code]
    name.php

    <?php
    $sql = "SELECT * FROM database";
    $result = mysql_query($sql);

    while ($rij = mysql_fetch_array($result))
    {

    echo ucfirst($rij['naam']);
     
    <BR />
    }
    ?>
    [/code]
  6. [!--quoteo(post=346014:date=Feb 15 2006, 03:05 PM:name=obsidian)--][div class=\'quotetop\']QUOTE(obsidian @ Feb 15 2006, 03:05 PM) [snapback]346014[/snapback][/div][div class=\'quotemain\'][!--quotec--]
    if you're always going to have it 3 levels deep, i'd simply recommend having 3 optimized tables that reference the category directly above. what you call them is entirely up to you, but i'd do something like this:

    [code]
    TABLE 1 - LEVEL 1
    =================
    id | Name
    ---------------
    1  | Computers
    2  | Games
    TABLE 2 - LEVEL 2 (references Table 1)
    =================
    id | ref | Name
    ---------------
    1  |  1  | Dell
    2  |  1  | HP
    3  |  2  | Shooter
    TABLE 3 - LEVEL 3 (references Table 2)
    =================
    id | ref |   Name   | Desc
    -----------------------------
    1  |  1  | Dell 270 | p2,7 512 mb etc.
    2  |  2  | HP120    | p3,7 1gig etc.
    3  |  3  | COD2     | new game blah, blah, blah
    [/code]

    then, you could very easily refer all the way back up the chain at any given time.

    may not fit everything you have in mind, but with the examples you gave, it's one of the best ways i could think of off the top of my head.

    hope this helps
    [/quote]

    i think i get it, but why don't i make 1 table:

    [code]
    TABLE 1

    id |ref|Name |Desc
    -----------------------------
    1  |  Computer  | Dell 270  | p2,7 512 mb etc.
    2  |  Computer  | HP120 | p3,7 1gig etc.
    3  |  Games | COD2 | new game blah, blah, blah
    [/code]
  7. hi,

    i want to create a site with the following link structuur.

    [b]Headlink, Sublink, Name, Page[/b]

    Like: Computers - Dell - Dell270 - p2,7 512 mb etc.
    Computers - HP - HP120 - p3,7 1gig etc.
    Games - Shooter - COD2 - new game blabla.

    What do you guys think is the best table structuur for this site ?
    what tables do i need to make and where to put the keys and things like that.

    thx,
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.