Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 2 of 2

Thread: LIMIT?

  1. #1
    Join Date
    Dec 2007
    Posts
    1,683
    Tokens
    0

    Latest Awards:

    Default LIMIT?

    How do you make PHP show only 20 of the newest fields on the page, but still able to check which username the comment is for, the current code is;

    PHP Code:
    if($_POST[comment]) {
    $message silence($_POST['little']);
    mysql_query("INSERT INTO comments (`from`, `for`, `message`, `date`) VALUES('$nivusr', '$propername', '$message', '$time')") or die(mysql_error());
    print(
    "<br /><br /><b>Your comment has been added.. please wait a couple of seconds!</b><meta http-equiv=\"refresh\" content=\"1\"/>");
    }
    }
    else {
    while(
    $showcomments mysql_fetch_array($commentcheck)) {

        
    $commentfrom = ($showcomments['from']);
        
    $commentmessage = ($showcomments['message']);
        
    $commentdate = ($showcomments['date']);
        
        
    $getmyfriendsimg mysql_query("SELECT * FROM profile WHERE `name` = '$commentfrom' ORDER BY `id`");
        while(
    $showmyfriendsimg mysql_fetch_array($getmyfriendsimg)) {
        
        
    $shiwmymatesava = ($showmyfriendsimg['myimg']);
        
    $shiwmymatename = ($showmyfriendsimg['name']);

    echo(
    '<table width="800" border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111">
      <tr>
        <td valign="top" width="50" height="1"><a href="http://www.nivade.com/profile/'
    .$commentfrom.'"><img border="0" img width="50" height="50" src="'.$shiwmymatesava.'"></a></td>
        <td valign="top" width="700" height="12"><a href="http://www.nivade.com/profile/'
    .$commentfrom.'">'.$commentfrom.'</a></b><br /><font color="'.$fontcolor.'" face="'.$font.'">'.$commentmessage.'<br /></td>
      </tr>
    </table><br />'
    );


  2. #2
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    "LIMIT 0, 20" In the mysqlQuery, and you need to paste the whole page as I can't under some of it, well most of it cause its so badly coded but yeah...

    You could limit like this, but this is a dumb way

    PHP Code:
    while ( $your_mum <= 20 )
    {
     
    $your_mum++;
     
    $comment $mysqlFetch'comment' ];
     
    $comment_name $mysqlFetch'name' ];
    }
    echo( 
    'Just echoed 20 of your_mums_so_fit comments' ); 
    Hi, names James. I am a web developer.

Posting Permissions

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