rondog Posted May 1, 2008 Share Posted May 1, 2008 I have a series of videos that were shot in a specific order. When the video is done playing, I want to be able to select the video in the row after the one that just ended. They all have auto incrementing IDs, but I cant just do currentID + 1 because I go through some of the videos and remove them resulting in a gap in the ids..like 68,70. Is their a mysql function that goes 1 row down? Link to comment https://forums.phpfreaks.com/topic/103746-solved-next-row-down/ Share on other sites More sharing options...
rhodesa Posted May 1, 2008 Share Posted May 1, 2008 SELECT MIN(id_field) FROM tablename WHERE id_field > '68' OR..if you want the whole row: SELECT * FROM tablename WHERE id_field > '68' ORDER BY id_field LIMIT 1 Link to comment https://forums.phpfreaks.com/topic/103746-solved-next-row-down/#findComment-531169 Share on other sites More sharing options...
rondog Posted May 1, 2008 Author Share Posted May 1, 2008 ok cool so I can do "SELECT * FROM video WHERE id > '$currentID'" I didnt know you could use the '<' and '>' signs thanks man! Link to comment https://forums.phpfreaks.com/topic/103746-solved-next-row-down/#findComment-531180 Share on other sites More sharing options...
rhodesa Posted May 1, 2008 Share Posted May 1, 2008 yup, and as long as the ID field is your primary key, it should automatically sort on that. but, to be safe, you may want to keep that ORDER BY Link to comment https://forums.phpfreaks.com/topic/103746-solved-next-row-down/#findComment-531182 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.