Hello,

I wonder how to create the page view. For example I would like to show only 5 rows or 10 rows of the columns.

http://www.masterlink.co.id/product_manager.jpg

product.php

<?php         

      include('../includes/koneksi.php');



        //Hapus berita // undefined index: mode

    //echo $id;

    if (!empty($_REQUEST['id']) && !empty($_REQUEST['mode']) && $_REQUEST['mode'] == "delete")
        {
        $id = $_REQUEST['id'];
        $result = mysql_query("DELETE FROM gallery WHERE id =".$id) or die(mysql_error());

        $confirmation = !$result ? "Gagal menghapus data." : "Data telah terhapus."; 
        }


?>
<div align="center">
    <div style="width:700px;text-align:left;padding-top:5px;">
        <?php  if (isset($confirmation)) { echo $confirmation; } ?>  
        <form method="get" action="<?php $_SERVER['PHP_SELF'] ?>">

                                    <br/>
                        <a class="topLink" href="input_image.php">Product baru >></a><br><br>

        <?php
                //LOAD NEWS

                $result = mysql_query("SELECT * FROM gallery") or die(mysql_error());
                ?>

                    <td>Show<select name="lokasi">
                    <option value="5">5</option>
                    <option value="10">10</option>
                    <option value="25">25</option>
                    <option value="50">50</option>                    
                    </select></td>entries<br><br>

                <table id="admintable" border="1" cellpadding="2" cellspacing="0">
                    <tr>
                        <th></th><th>Product Name</th><th>Lokasi</th><th>Description</th><th>Url Images</th><th>Action</th>
                    </tr>
                    <?php
                    $i=0;
                    while ($data = mysql_fetch_array($result)){
                    $result2=($i%2)?'#DFA09D':'white';

                            echo "<tr bgcolor='$result2'>";
                            echo '<td><input type="checkbox" name="vehicle" value="Bike"></td>';                               
                            echo '<td>'.$data['productname'].'</td>';
                            echo '<td>'.$data['location'].'</td>';
                            echo '<td>'.$data['description'].'</td>';
                            echo '<td>'.$data['urlimages'].'</td>';
                            echo '<td><a href="product.php?mode=delete&id='.$data['id'].'">Hapus</a> |<a href="input_image.php?id='.$data['id'].'">Edit</a></td>';
                        echo '</tr>';

                    $i++;   
                    }                   
                    ?>

                </table>

                <br>
                    <tr>
                    <td><select name="lokasi">
                    <option value="Show">Show</option>
                    <option value="DoNotShow">Do Not Show</option>
                    <option value="Delete">Delete</option>                    
                    </select></td>
                    <td><input type="submit" name="ok" value="Apply"/></td>
                    </tr>

        </form>
    </div>
</div>
  </center>
</div>  


</div>

Use Jquery.. it will help you a lot.

How? I understand php better than JQuery

@<M/>, I could be wrong, but I think he was talking about pagination and only showing a set number of results from the database.

Here is a decent example of using pagination with PHP, MySQL, and jQuery.
http://www.9lessons.info/2009/09/pagination-with-jquery-mysql-and-php.html

There are a ton of different tutorials online for this type of thing.

commented: :) +8

@davy_yg, don't click on the little icon that indicates download, click on the text that tells you to download. It worked for me. If you still can't download it, i can send you the file.

@pixelsoul, i don't know what he was referring to also, but i did my best to pitch in and assist.

Parse error: syntax error, unexpected '=' in C:\xampp\htdocs\Bread\oldpagination\config.php on line 5

<?php
$mysql_hostname = "localhost";
$mysql_user = "root";
$mysql_password = "";
mysql_database = "bread";
$prefix = "";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Opps some thing went wrong");
mysql_select_db($mysql_database, $bd) or die("Opps some thing went wrong");

?>

line 5 : mysql_database = "bread";

why is it?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.