Hello, I programmed a simple script that allows me to put information into my MySQL table using a simple form. Now I want to display the information like this: ID1(<-from my MySQL table) goes in an HTML div and ID2 goes in another div, ... And when their are like 20 DIVs on the page, it will need to create a second page and so on. Is this posible? If yes, could you give me a tutorial/script? Or is the only way getting this by putting money on the table? Jelle
Hey, It's called pagination. http://php.about.com/od/phpwithmysql/ss/php_pagination.htm http://www.tonymarston.net/php-mysql/pagination.html
Not really, unless you want to have neat and tidy links at the bottom linking to the next page etc. For basics though, you need to pass along a variable in the url either being 'page' or 'start'. So... <?php $start = (int) $_GET['start']; $sql = "SELECT item_id, field_1, field_2, field_3 FROM table_1 WHERE what = that LIMIT {$start}, 20"; // etc etc etc // do your mysql looping to show the results // Now make a count of how many results there actually are in the db $sql = "SELECT count(item_id) FROM table_1"; // put that into a var, and use that to build the paginator with a loop // so for eg, in simple terms: $totalPages = $result_from_your_count_query; // loop through to get your pages for ( $i = 0; $i < $totalPages; $i + 20 ) { echo $i .', '; } PHP: Maybe that might give an idea, although it's kinda dodgey. Not the best solution, and possibly the worst, but just for an idea!
^^I also want to have the tiny links. But since it's not so complicated for experienced PHP'ers it wouldn't cost as much to get it done I think.