cgm225 Posted February 11, 2008 Share Posted February 11, 2008 Currently I grab entries/rows from a mysql database for my gallery based on the following: $query = "SELECT * FROM images WHERE album = $album_id ORDER BY timestamp DESC LIMIT $lower_limit , $upper_limit"; //the upper and lower limit variables are numeric integers in value, for example: 30, 60 $image_results = mysql_query($query); My question is, what is the easiest way to check, separately, if there exists an entry/row right before the lower limit, and if there exists an entry/row right after the upper limit? Thank you for your help. Quote Link to comment https://forums.phpfreaks.com/topic/90571-checking-for-mysql-entryrow-before-and-after-limits/ Share on other sites More sharing options...
teng84 Posted February 11, 2008 Share Posted February 11, 2008 I don't understand the question! Quote Link to comment https://forums.phpfreaks.com/topic/90571-checking-for-mysql-entryrow-before-and-after-limits/#findComment-464374 Share on other sites More sharing options...
cgm225 Posted February 12, 2008 Author Share Posted February 12, 2008 Sorry, let me clarify.. if I use the query I outlined above, and limit the returned rows such that only the 30th to 60th rows are returned (limits I set dynamically using the $lower_limit and $upper_limit php variables), what is the best way to check for the existence of rows immediately adjacent to the upper and lower limits (so, in this example, is there a 29th and 61st row?). I am checking for these rows to determine if a previous/next button is to be included in my pagination. Thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/90571-checking-for-mysql-entryrow-before-and-after-limits/#findComment-465049 Share on other sites More sharing options...
revraz Posted February 12, 2008 Share Posted February 12, 2008 I would think the pagination tutorial would explain that? Quote Link to comment https://forums.phpfreaks.com/topic/90571-checking-for-mysql-entryrow-before-and-after-limits/#findComment-465053 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.