need help in recent comment

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    does this work?
    PHP Code:
    $result mysql_query("SELECT MAX(id), * FROM comment GROUP BY bid ORDER BY id desc LIMIT 10"); 

    Comment


      #17
      Originally posted by something else View Post
      does this work?
      PHP Code:
      $result mysql_query("SELECT MAX(id), * FROM comment GROUP BY bid ORDER BY id desc LIMIT 10"); 
      no its not working.

      Comment


        #18
        Originally posted by asifnayem View Post
        no its not working.
        supplied argument is not a valid MySQL result resource check if id field exists in your table
        This is ten percent luck, twenty percent skill
        Fifteen percent concentrated power of will
        Five percent pleasure, fifty percent pain

        And a hundred percent reason to remember the name!

        Comment


          #19
          Originally posted by just_m3. View Post
          supplied argument is not a valid MySQL result resource check if id field exists in your table
          PHP Code:

          CREATE TABLE 
          `comment` (
            `
          idint(11NOT NULL auto_increment,
            `
          bidint(11NOT NULL,
            `
          blogidint(11NOT NULL,
            `
          widint(11NOT NULL,
            `
          uidint(11NOT NULL,
            `
          replyint(11NOT NULL,
            `
          commentstext NOT NULL,
            `
          timeint(11NOT NULL,
            `
          subcommentint(11NOT NULL,
            `
          hasubcommentint(1NOT NULL,
            
          PRIMARY KEY  (`id`)
          ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=
          my comment table
          Last edited by asifnayem; 14.04.12, 16:46.

          Comment


            #20
            try this: .... if it doesnt work let us know the error
            PHP Code:
            $result mysql_query("SELECT MAX(id) AS id, bid  FROM comment GROUP BY bid ORDER BY id desc LIMIT 10") OR die(mysql_error()); 
            you may need to add a few more row name above ^

            Comment


              #21
              Originally posted by something else View Post
              try this: .... if it doesnt work let us know the error
              PHP Code:
              $result mysql_query("SELECT MAX(id) AS id, bid  FROM comment GROUP BY bid ORDER BY id desc LIMIT 10") OR die(mysql_error()); 
              you may need to add a few more row name above ^
              It has no error but the same old thing, showing the first comment of the posts not the last one. i think there should be two order by system.

              Comment


                #22
                bro, would u plz help?

                Comment


                  #23
                  yeah it need a sub query .... i will set up a table on my database and work it out when im more awake ....
                  had very little sleep past few days :P

                  Comment


                    #24
                    PHP Code:
                    $result mysql_query("SELECT a.* FROM comment a INNER JOIN (SELECT MAX(id) AS id FROM comment GROUP BY bid) b ON a.id = b.id LIMIT 10"); 
                    Tested and working

                    Comment


                      #25
                      thanks :* it works. also i added order by id desc before the limit word.

                      Comment

                      Working...
                      X