Results 1 to 7 of 7

Thread: how to sort the content posts ?

  1. #1
    Join Date
    Jun 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default how to sort the content posts ?

    hi
    i have afunction that work like this :
    it post a Temporary message on the page ,
    in the same time it insert the content in the database .
    and after refresh the wall page the Temporary message go away and
    the content from the database showing .
    content from the database displaying ordered by asc .
    but the Temporary messages become ordered by dec .

    i want please wen i post 5 Temporary messages ( 1 , 2 ,3 ,4 ,5 ) ,
    to be like this : (start from 1 )
    1
    2
    3
    4
    5

    but on my site it is like this : (start from 1 )
    5
    4
    3
    2
    1

    how can i make them becom sortting by asc in real time ? i mean if i post 1 then post 2 , post 2 will be under post 1 .

    this is my function :



    thank you verry much
    Last edited by sofian; 06-26-2011 at 03:31 AM.

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    what CMS are you using? Those are all user-defined functions; we have no way of knowing what they do unless you post the related code.

  3. #3
    Join Date
    Jun 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by traq View Post
    what CMS are you using? Those are all user-defined functions; we have no way of knowing what they do unless you post the related code.
    hellow traq and thank you ...


    thank you verry much
    Last edited by sofian; 06-26-2011 at 03:31 AM.

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    There are several lines in that function that do not use regular mysql functions - for example, sql_query(), sql_fetch_array(), tb(), and avatar() are user-defined. I can guess at what they do, but I cannot know that I am correct, or even if I am, that what I suggest will be compatible with your existing system.

    Quote Originally Posted by sofian
    in fact i have asocialnetwork that work like facebook exactly .
    what CMS (or other web software) are you using?
    What is the name of the software? This is important, because we will be able to give you a better answer and/or find other help for you if we know what you are using now.
    Without knowing, we must resort to guesswork and trial and error.

    From what you posted, it appears that your comment_display() function, as well as its calling function comment_publish(), only deals with a single comment. That means that there is some other function involved that determines what order the comments are displayed in (or perhaps not - and the comments are simply displayed in their natural order).

    In any case, it is impossible to offer further advice without knowing something about your existing code structure.

  5. #5
    Join Date
    Jun 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    agaian thank you verry much traq for your replys and help.
    Last edited by sofian; 06-26-2011 at 03:30 AM.

  6. #6
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    try changing this line:
    PHP Code:
    $res sql_query("select c.*,u.username,u.avatar from ".tb()."comments as c left join ".tb()."accounts as u on u.id=c.uid where c.stream_id='{$target_id}' order by id asc "); 
    to this
    PHP Code:
    $res sql_query("select c.*,u.username,u.avatar from ".tb()."comments as c left join ".tb()."accounts as u on u.id=c.uid where c.stream_id='{$target_id}' order by id DESC "); 
    although that's just an educated guess.

    If your software is closed source (not sharable), then I would recommend looking for help from the author and/or the official website.

  7. #7
    Join Date
    Jun 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    hi traq

    ok and thank you verry verry much
    thanks

Bookmarks

Posting Permissions

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