Jump to content


Photo

Returning the next integer from an auto_increment field


  • Please log in to reply
23 replies to this topic

#21 roopurt18

roopurt18
  • Staff Alumni
  • Advanced Member
  • 3,749 posts
  • LocationCalifornia, southern

Posted 06 October 2007 - 06:50 AM

If you know the id of the image you're currently displaying is some value, and you want the next image with a larger id:
SELECT * FROM table WHERE id > {$id} AND cat='PHOTO' ORDER BY id ASC LIMIT 1

But do you have to be a jerk?  You're a moderator, right?  Isn't part of your job to help?

AFAIK, none of the moderators are paid to run this site, so it's none of their jobs to do anything.  Also, when fenway said "look it up first," I think he may have meant look up the next record that is of the same category and create a link for it.

Not everyone is out to get you, ya know?
PHP Forms : Part I | Part II

JavaScript: Singleton

http://www.rbredlau.com

#22 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 06 October 2007 - 09:24 AM

At least point me in a direction

I thought I did...

Look it up first...

Didn't realize that I had to say "in the table where you just put this record"; thanks for having my back, roopurt18.

But do you have to be a jerk?  You're a moderator, right?  Isn't part of your job to help?

It's quite obvious that in all the time you've spent here with your 7 posts and all that you haven't noticed that I've NEVER told anyone to "go searching" for anything online in any of my 5,749 posts.  Maybe from now on you'll be more receptive and less defensive.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#23 mystic_bovine

mystic_bovine
  • Members
  • Pip
  • Newbie
  • 9 posts

Posted 07 October 2007 - 12:33 PM

Fenway,

Sorry, I honestly read "Look it up first..." as "look it up first in the forum then post the question". 

Like I said I really appreciate the resource that this forum and phpfreaks.com is.  I'm slowly teaching myself PHP and mySQL and I've only posted 7 times because I usually find the answer first. I hope one day to be knowledgeable enough to post some answers.



#24 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 07 October 2007 - 03:48 PM

Fenway,

Sorry, I honestly read "Look it up first..." as "look it up first in the forum then post the question". 

Like I said I really appreciate the resource that this forum and phpfreaks.com is.  I'm slowly teaching myself PHP and mySQL and I've only posted 7 times because I usually find the answer first. I hope one day to be knowledgeable enough to post some answers.


No worries...
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users