icez Posted September 12, 2009 Share Posted September 12, 2009 Hey, I'm using IPB forum and I added a field that I need to list in a blank page. Because of some function or what ever in mysql, I need to get a list of member_id I want, and after with these id, I need to list the field_13... so if anyone can tell me what is wrong in my code please =D <?php // Secret Mysql Connect xD $query = "SELECT member_id FROM ipb_members WHERE member_group_id=7 or member_group_id=4 or member_group_id=6"; $result = mysql_query($query) or die('Error : ' . mysql_error()); while(list($member_id) = mysql_fetch_array($result, MYSQL_NUM)){ $id = "member_id=$member_id or "; // there is an or at the end of my mysql request... maybe my problem $query2 = "SELECT field_13 FROM ipb_pfields_content WHERE '$id'"; $result2 = mysql_query($query2) or die('Error : ' . mysql_error()); while(list($field_13) = mysql_fetch_array($result2, MYSQL_NUM)) { echo "$field_13<br />"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/173980-solved-need-help-with-mysqlphp/ Share on other sites More sharing options...
RussellReal Posted September 12, 2009 Share Posted September 12, 2009 <?php $query = "SELECT member_id FROM ipb_members WHERE member_group_id=7 or member_group_id=4 or member_group_id=6"; $result = mysql_query($query) or die('Error : ' . mysql_error()); $ids = array(); while(list($member_id) = mysql_fetch_array($result, MYSQL_NUM)){ $ids[] = "'{$member_id}'"; } $id = implode(',',$ids); $query2 = "SELECT field_13 FROM ipb_pfields_content WHERE member_id IN ({$id})"; $result2 = mysql_query($query2) or die('Error : ' . mysql_error()); while(list($field_13) = mysql_fetch_array($result2, MYSQL_NUM)) { echo $field_13."<br />"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/173980-solved-need-help-with-mysqlphp/#findComment-917092 Share on other sites More sharing options...
icez Posted September 12, 2009 Author Share Posted September 12, 2009 Thank you very much! Quote Link to comment https://forums.phpfreaks.com/topic/173980-solved-need-help-with-mysqlphp/#findComment-917229 Share on other sites More sharing options...
RussellReal Posted September 12, 2009 Share Posted September 12, 2009 oops.. mispost Got ahead of myself <3 anytime buddy Quote Link to comment https://forums.phpfreaks.com/topic/173980-solved-need-help-with-mysqlphp/#findComment-917306 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.