monkeytooth Posted July 3, 2011 Share Posted July 3, 2011 Ok, this is my query.. SELECT email FROM memb_loginInfo WHERE email IN ('".$email."') ORDER BY email ASC Which if I run that through phpMyAdmin I yield 5 results, even running it through my script I am still yielding 5 results as per echoing out the num_rows tells me. But when I try to loop through the output arrays worth of data I can only get the first result. I have tried for, foreach, while to no success. Only thing that outputs anything is the foreach. Yet I only get one. foreach($row as $found) { //echo $found; $outputArray['output'][] = array('name' => "none", 'email' => $row['email']); } Where am I going wrong here? Link to comment https://forums.phpfreaks.com/topic/240983-looping-through-a-mysql-in-query-and-stuck/ Share on other sites More sharing options...
Psycho Posted July 3, 2011 Share Posted July 3, 2011 You're not showing enough of your code, but it would go something like this: $query = "SELECT email FROM memb_loginInfo WHERE email IN ('{$email}') ORDER BY email ASC"; $result = mysql_query($query); while($row = mysql_fetch_assoc($result)) { echo "{$row['email']}<br>\n"; } Link to comment https://forums.phpfreaks.com/topic/240983-looping-through-a-mysql-in-query-and-stuck/#findComment-1237820 Share on other sites More sharing options...
monkeytooth Posted July 3, 2011 Author Share Posted July 3, 2011 Yea, I found my problem a little while ago, it was something steming down right after the query that was tripping up the loop, I do appreciate the assistance none the less thank you. Link to comment https://forums.phpfreaks.com/topic/240983-looping-through-a-mysql-in-query-and-stuck/#findComment-1237826 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.