Jump to content

Checking if lowest value


EchoFool

Recommended Posts

If i do query to get all rows for a specific WHERE clause and order it by ID.

 

What i do then is while loop the rows. How ever on the "first" loop i.e the first row being echo'd i want it to say "This is the first row" and the rest do not have it.

 

What i thought was to "Find lowest ID" of the selected rows" ... as it is ordered by ID ... that would surely suggest the lowest ID is the first of the rows right?

 

Can it be done solely with the main query and php or will i need an additional query in the while loop to check if the post is the first or something?

Link to comment
Share on other sites

Yeh i already have  the query made and already have it looped but i need a way to find out that the first row that is looped is the first if you get me so that it will show:

 

id   |  name  | is first

23  |  bleh    |    this is first post

42  |  fefw    | 

56  |  fsffs    |

 

like that is what I want it to work out. That the first row that comes out of the loop is the first and so will echo the statement "this is the first post"

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.