Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005
    Posts
    2

    Question Unanswered: How can I display a row of 10?

    Hi

    Wonder if anyone can help to make it display in row of 10 as the total result is shown all in a single page of 1,500 records.

    Here is the code:
    PHP Code:
    <?php 

    include("database.php"); 
    include(
    "user.php"); 
    checklogin(); 


    if(isset(
    $_POST['Submit'])) 

        
    $total $_POST['total']; 
        
    $td 0
        
    $i 0

        for(
    $i 1$i <= $total$i++) 
        { 
            if(isset(
    $_POST["d$i"])) 
            { 
                
    mysql_query("DELETE FROM user_list WHERE id=".$_POST["d$i"],$link); 
                
    $td++; 
            } 
        } 

        
    $msg "$td record(s) deleted!"


    $result mysql_query("Select * from user_list",$link); 
    $num mysql_num_rows($result); 
    $n 0
    ?>
    Code:
    <h3>List of Records</h3>
    
    <form name="form1" method="post" action="">
      <p>&nbsp;</p>
      <table width="70%" border="1" cellpadding="1" cellspacing="1" bordercolor="#000000">
        <tr bgcolor="#CCCCCC">
          <td width="3%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">&nbsp;</font></td>
          <td width="3%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>ID</strong></font></td>
          <td width="15%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>User</strong></font></td>
          <td width="15%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Password</strong></font></td>
          <td width="20%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Date Joined</strong></font></td>
          <td width="20%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Last Login</strong></font></td>
          <td width="10%"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>Count</strong></font></td>
        </tr>
        <?php while($row = mysql_fetch_array($result, MYSQL_BOTH)){
    $n++;
    ?>
        <tr>
          <td><input type="checkbox" name="d<?php echo $n;?>" value="<?php echo $row['id'];?>"></td>
          <td><a href="newrecord.php?id=<?php echo $row['id']?>"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row['id'];?></font></a></td>
          <td><a href="newrecord.php?id=<?php echo $row['name']?>"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row['username'];?></font></a></td>
          <td><a href="newrecord.php?id=<?php echo $row['password']?>"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row['password'];?></font></a></td>
          <td><a href="newrecord.php?id=<?php echo $row['joined']?>"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row['joined'];?></font></a></td>
          <td><a href="newrecord.php?id=<?php echo $row['lastlogin']?>"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row['lastlogin'];?></font></a></td>
          <td><a href="newrecord.php?id=<?php echo $row['count']?>"><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><?php echo $row['logincount'];?></font></a></td>
        </tr>
        <?php
    
     }?>
        <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="Submit" value="Delete"> <input name="total" type="hidden" id="total" value="<?php echo $n?>"></td>
        </tr>
      </table>
    <p>&nbsp;</p></form>

  2. #2
    Join Date
    Feb 2004
    Location
    India
    Posts
    135

    Pagewise Display

    Hi,

    i think ur solution is might be in this method. Dont hesitate ask question reg. this.

    http://www.weberdev.com/get_example-3973.html


    Expecting ur Mail

    saravanan.r@gmail.com
    Saravanan.R

  3. #3
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    there is a class available form phpclasses which can handle this, however its not that difficult to do without the class. YOu just need to know what page you are on, keep a track of any parameters fed to the query and extract the corredct number of rows.

Posting Permissions

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