Danny696 Posted May 16, 2009 Posted May 16, 2009 i need help with a npc page im making im stuck on the editing bit and i only have the dropdown box for allusers any idea how to change it so it only shows the NPC's in a dropdown box heres the users dropdown box ".user_dropdown($c,'user')." Quote
TMan Posted May 26, 2009 Posted May 26, 2009 Re: V2 help in staff_users its saying NPC's user_level = 0 Type: <input type='radio' name='user_level' value='0' />NPC <input type='radio' name='user_level' value='1' checked='checked' />Regular Member Possibly something like: $db->query(sprintf("SELECT * FROM users WHERE user_level=%u" , 0)); The code you have is from that page but the function is from global_func.php: function user_dropdown($connection,$ddname="user",$selected=-1) { global $db; $ret="<select name='$ddname' type='dropdown'>"; $q=$db->query("SELECT * FROM users ORDER BY username ASC"); if($selected == -1) { $first=0; } else { $first=1; } while($r=$db->fetch_row($q)) { $ret.="\n<option value='{$r['userid']}'"; if ($selected == $r['userid'] || $first == 0) { $ret.=" selected='selected'";$first=1; } $ret.= ">{$r['username']}</option>"; } $ret.="\n</select>"; return $ret; } This Should lead you in the direction you want i believe. Quote
Miniman Posted May 26, 2009 Posted May 26, 2009 Re: V2 help http://criminalexistence.com/ceforums/i ... ic=27041.0 There is something Illusions made :) That only finds NPC's. Possibly something like: $db->query(sprintf("SELECT * FROM users WHERE user_level=%u" , 0)); Why are you selecting everything from the User's Table? And you really don't need to use sprintf() here. $db->query("SELECT `userid`,`username`,`user_level` FROM users WHERE user_level=0"); Quote
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.