drummer101 Posted March 7, 2008 Share Posted March 7, 2008 I've got a problem that I still haven't solved thats been bugging me for weeks. SELECT phpbb_user_group.group_id FROM phpbb_user_group WHERE phpbb_user_group.user_id = '".$i['user_id']."' ORDER BY phpbb_user_group.group_id DESC Will return, say, 4 results. How do I store those in an array so that I can use the php function in_array to see if the value exists in the array? (A normal while loop?) Quote Link to comment Share on other sites More sharing options...
scvinodkumar Posted March 7, 2008 Share Posted March 7, 2008 make a while and store each value in a array. For example as per your code, $query ="query"; $result = mysql_query($query); while($fetch=mysql_fetch_object($result)) { $array_name []= $fetch->group_id; } Try this.. Quote Link to comment Share on other sites More sharing options...
drummer101 Posted March 7, 2008 Author Share Posted March 7, 2008 I'm having the hardest time wrapping my head around arrays. I keep waiting for something to click into place but it just never happens =\ I used the code provided, and was greeted with, Notice: Trying to get property of non-object in D:\Apache2\htdocs\*****\functions.php on line 636 Array ( [0] => ) From what I've gathered, $fetch would be my index and group_id would be my value. so, $fetch[2] would be the 2nd value the query returns? Quote Link to comment Share on other sites More sharing options...
drummer101 Posted March 7, 2008 Author Share Posted March 7, 2008 bump to try and get a grip on things =\ 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.