MDanz Posted November 4, 2009 Share Posted November 4, 2009 how do i echo 1st result, 2nd result, 3rd result? i know how to echo all of them, how do i echo the specific... e.g. 2nd result in query. $addz = mysql_query("SELECT * FROM Stacks WHERE username = 'Admin'")or die (mysql_error()); while($rowrun = mysql_fetch_array( $addz)) { $idz = $rowrun['id']; } Quote Link to comment https://forums.phpfreaks.com/topic/180319-solved-echo-results/ Share on other sites More sharing options...
ram4nd Posted November 4, 2009 Share Posted November 4, 2009 if($rowrun['id'] == 2) echo $rowrun['what_ever_is_the_col_name']; Quote Link to comment https://forums.phpfreaks.com/topic/180319-solved-echo-results/#findComment-951210 Share on other sites More sharing options...
MDanz Posted November 4, 2009 Author Share Posted November 4, 2009 i don't see how that would work... the id isn't 2. i want the second result from the query.... not where the id=2. Quote Link to comment https://forums.phpfreaks.com/topic/180319-solved-echo-results/#findComment-951213 Share on other sites More sharing options...
mikesta707 Posted November 4, 2009 Share Posted November 4, 2009 use a counter? $addz = mysql_query("SELECT * FROM Stacks WHERE username = 'Admin'")or die (mysql_error()); $i = 0; while($rowrun = mysql_fetch_array( $addz)) { $idz = $rowrun['id'] if ($i == 2){//or i = whatever you want. this would be the third run of the loop echo $idz; } $i++; } Quote Link to comment https://forums.phpfreaks.com/topic/180319-solved-echo-results/#findComment-951217 Share on other sites More sharing options...
MDanz Posted November 4, 2009 Author Share Posted November 4, 2009 thx got it. Quote Link to comment https://forums.phpfreaks.com/topic/180319-solved-echo-results/#findComment-951219 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.