Log in

View Full Version : how to sort the content posts ?



sofian
06-24-2011, 01:52 PM
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 :)

traq
06-24-2011, 02:20 PM
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.

sofian
06-24-2011, 05:26 PM
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

traq
06-24-2011, 11:44 PM
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.


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.

sofian
06-25-2011, 07:10 AM
agaian thank you verry much traq for your replys and help.

traq
06-25-2011, 08:10 PM
try changing this line:
$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
$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.

sofian
06-26-2011, 03:33 AM
hi traq

ok and thank you verry verry much
thanks