I want to auto load new data into my php page, my homepage is getting to long with statuses, so when people go to the home page i want it to only show ten, then when they scroll to the bottom of the page, it loads the next ten, and so on.

right now this is what i have set to load the data.

                $sql = mysql_query("SELECT * FROM post WHERE Deleted like '0' ORDER BY ID DESC");
                $numrows = (mysql_num_rows($sql));
                if($numrows > 0){
                    while ($row = mysql_fetch_assoc($sql)){
                        $uid = $row['UID'];
                        $postid = $row['ID'];
                        $post1 = $row['Post'];
                        $Timestamp = $row['Timestamp'];
                        $id = $row['ID'];
                        $check_pic = "members/$uid/image01.jpg";
                            $user_pic ="<img src=\"$check_pic\" width=\"50\" heign='50'>";
                            $user_pic ="<img src=\"$default_pic\" width=\"50\" heign='50'/>";
                        if ($user=='1'){
                            $type = 'Admin';
                            $type = 'member';
                        $namesql = mysql_query("SELECT * FROM members WHERE ID like $uid");
                        while($row = mysql_fetch_assoc($namesql)){
                            $firstname = $row['firstname'];
                            $lastname = $row['lastname'];
                            $Name = "$firstname $lastname";
                            $uid1 = $_COOKIE['idCookie'];
                            if($uid == $uid1){
                                $delete = "  - <a href='index.php?delete=$id'><img border='0' title='Delete this post.' src='images/delete.jpg'></a>";
                                $delete = "";
                        $reg_exUrl = "/(http|https|ftp|ftps)\:\/\/[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(\/\S*)?/";
                        $text = $post1;
                        if(preg_match($reg_exUrl, $text, $url)){
                            $text = preg_replace($reg_exUrl, "<a href='{$url[0]}'>{$url[0]}</a>", $text);
                    echo "<table width='100%'>
                                <tr><td width='51' valign='top'>$user_pic</td><td valign='top'><a href='profile.php?id=$uid'>$Name</a>$delete<br>$text<br><span style='font-size:0.8em;'>Posted: $Timestamp</span><br></td></tr>
                                <tr><td colspan='2' bgcolor='#EEEEEE'>
                                <a href='#' onclick=\"document.getElementById('$postid').style.display = 'block';\">Comment</a>
                                    <form action='index.php?comment=$postid' method='post'>
                                    <div id='$postid' style='display:none;'>
                                    <input type='text' name='message'/>
                                    <input name='uid' type='hidden' value='$uid1' />
                                    <input name='comment' type='hidden' />
                                    <input name='pid' type='hidden' value='$postid' />
                                    <input type='submit' value='Post'/>
                                </td></tr><tr><td colspan='2' bgcolor='#EEEEEE'>";
                            $commentsql = mysql_query("SELECT * FROM postcomment WHERE postid like $postid");
                            while($row = mysql_fetch_assoc($commentsql)){
                                $comment = $row['comment'];
                                $uid = $row['uid'];
                                $pid = $row['postid'];
                                $commentname = mysql_query("SELECT * FROM members WHERE id LIKE $uid");
                                while($row = mysql_fetch_assoc($commentname)){
                                    $firstname = $row['firstname'];
                                    $lastname = $row['lastname'];
                                    $name = "$firstname $lastname";
                                    $uid123 = $row['id'];
                                    $check_pic = "members/$uid/image01.jpg";
                                        $user_pic1 ="<img src=\"$check_pic\" width=\"32\" border='0' height='32'/>";
                                        $user_pic1 ="<img src=\"$default_pic\" width=\"32\" border='0' height='32'/>";
                                    if($postid == $pid)
                                        echo "<div style=\"float:left;margin:0 5px 5px 0;\"><a href='http://www.daparadise.com/profile.php?id=$uid123'>$user_pic1</div>$name</a><br>$comment<br><hr>";
                            echo "</td></tr></table>
                    echo "Theres no statuses to display!";
5 Years
Discussion Span
Last Post by diafol

Sounds like you need a paginator. This can be a js-driven show/hide affair or php (or ajax) driven.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.