smerny Posted August 3, 2009 Share Posted August 3, 2009 I am looping an array of rows and I would like the last row or two to have something different done to it during the loop through... is there a way I can do this easily? Like mysql pass on to php that it is in it's last row or two? The only thing I could think of is to get the number of rows with mysql_num_rows have a var count the number of loops through... is there a better way? Quote Link to comment Share on other sites More sharing options...
smerny Posted August 3, 2009 Author Share Posted August 3, 2009 for example this is what i'm using atm $num_msgs = mysql_num_rows($result); while ($posts = mysql_fetch_array($result)) { $num_msgs -= 1; if ($num_msgs >1) { Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted August 3, 2009 Share Posted August 3, 2009 The way you've come up with is probably the most simple to implement. Quote Link to comment Share on other sites More sharing options...
smerny Posted August 3, 2009 Author Share Posted August 3, 2009 alright... thanks 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.