Jump to content

PHP & MySQL WHERE order listing help.


Salis

Recommended Posts

I know that there are a few free Forums and BB out there but they do have their limitations, even with mods. I am working on a site that has a forum but it is a special forum.

I know PHP and MySQL. I can create every thing that I need, the control panels, register pages post pages and what not, I can even make a topic viewer but that is the problem. Basically If I make a post then some one else and after some one else another guy, but when the posts are read from the database they are not listed as they need to be. It's like this:

[i]This is how it should be[/i]

Salis: Yo, So are we ready?
The_Kid: No, not 'till tomorrow
robins-j: What's the hold up

Ok, but this is what it would look like when read from the database

The_Kid: No, not 'till tomorrow
Salis: Yo, So are we ready?
robins-j: What's the hold up

This is the code I'm using to pull the info from the DB

[code]
$query = mysql_query("SELECT * FROM posts WHERE page_id = '$id'");

while ($row = mysql_fetch_array($query))
{
  include('view_post.php');
}
[/code]

I'm guessing it's something simple but I'm not sure. Can any one help me out?

*EDIT*
I forgot to mention that I do have a posting count set as a primary and an auto incerment
Link to comment
Share on other sites

So in my case

[code]
$query = mysql_query ( "SELECT * FROM posts WHERE page_id='$id' ORDER BY post_count ASC" );
[/code]

Thank you a lot. I figured it was something simple!

Also, I refer back to PHPfreaks for nearly all the help. Awesome Site and Community!
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.