Hi Folks, I want to select next id from the table. I am getting this error can anyone please fix this code. $result = $dbase->get_results("SELECT * FROM `likes` WHERE like_id > $iLikeId ORDER BY like_id ASC LIMIT 1,1"); Code (markup):
What type of field is like_id. Is it definitely an INT, because if not you will need to put $iLikeId in quotes.
Thanks for quick reply.... Is this correct? $result4 = $dbase->get_results("SELECT * FROM `likes` WHERE like_id > '$iLikeId' ORDER BY like_id ASC LIMIT 1,1"); Code (markup): Now that error has been fixed...but this code is to get id=2 because of ASC LIMIT 1,1. If I keep ASC LIMIT 2,1 it is getting id=3 always. ASC LIMIT 3,1 gets id=4. I need a code to get next id? not the same id everytime Did you understand my problem?
Problem has been solved Thanks to http://www.scottklarr.com/topic/111/how-to-select-previousnext-rows-in-mysql/ Code (markup):