The Little Guy Posted September 1, 2011 Share Posted September 1, 2011 Is there a way to get the mysql's internal pointer position? I have searched Google, found this: <?php function mysql_pointer_position($result_set) { $num_rows = mysql_num_rows($result_set); $i = 0; while($result = mysql_fetch_array($result_set)) { $i++; } $pointer_position = $num_rows - $i; //Return pointer to original position if($pointer_position <= $num_rows - 1) { mysql_data_seek($result_set, $pointer_position); } return $pointer_position; } ?> But I don't really like it. Is there a better way to find the current position of the internal pointer? Quote Link to comment Share on other sites More sharing options...
Psycho Posted September 1, 2011 Share Posted September 1, 2011 What are you trying to accomplish that requires you to get the pointer position? My guess is there is a more efficient method to do what you want. But, if you really need to know the pointer position (which I really doubt), then build a class to use to replace the mysql_fetch_ functions that will maintain the pointer position as a property in the class. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted September 1, 2011 Author Share Posted September 1, 2011 it is for my library, and some people may want to know the current pointer position, so I want to add it to my library. Quote Link to comment 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.