phpSensei Posted November 10, 2007 Share Posted November 10, 2007 Why does it work when i put user_level = '1', but not when I put "user_level = '1' and user_level = '2' " <?php $reporting = mysql_query("SELECT * FROM phpbb_users WHERE user_level = '1' & user_level = '2'"); echo' <br> <br> <br /> <br /> <table width="603" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="35" align="left" background="images/portal/featured/featuredtexttop.jpg"> <span class="style28">Report<span class="style17"> a submission</span></span></td> </tr> <tr> <td height="111" align="center" valign="middle" bgcolor="#0B0B0B" class="style29"><br /> <table width="462" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="400"><form name="form1" id="form1" method="post" action="view.php?subID='.$row['id_sub'].'&mode=Report_sub"> <table width="100%" border="0" cellspacing="6" cellpadding="0"> <tr> <td width="20%" align="left" valign="top">Reason</td> <td width="80%" align="left" valign="top"><label> <select name="reason" size="1" class="listmenu" id="reason"> <option value="Contains Adult Contents">Contains Adult Contents</option> <option value="Illegal Material (drugs, pirate links, milicious code..etc)">Illegal Material (drugs, pirate links, milicious code..etc)</option> <option value="Threat to your life or friend">Threat to your life or friend</option> </select> </label></td> </tr> <tr> <td align="left" valign="top">Report To </td> <td align="left" valign="top"><select name="user" class="listmenu" id="user"> '; while($to = mysql_fetch_array($reporting)){ echo '<option value="'.$to['username'].'">'.$to['username'].'</option>'; } echo' </select></td> </tr> <tr> <td height="125" align="left" valign="top">Add details </td> <td align="left" valign="top"><label> <textarea name="detail" cols="40" rows="10" class="login_field" id="detail"></textarea> </label></td> </tr> <tr> <td height="43" colspan="2" align="center" valign="middle"><label> <input name="pm" type="submit" class="button_submit" id="pm" value="Send PM to Mod/Admin" /> </label></td> </tr> </table> </form></td> </tr> </table></td></tr> </table><br><br> </td></tr> </table></td> <td width="20" rowspan="2" valign="top" bgcolor="#1D1D1D"><br /></td> </tr> <tr> <td colspan="3" valign="top" bgcolor="#242424"></td> </tr> </table> </td> </tr> </table> <table width="200" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><img src="images/footer/adverticetop.jpg" width="850" height="29" /></td> </tr> <tr> <td height="99" background="images/footer/adverticemiddle.jpg"><div align="center" class="style1 style3">A d v e r t i c e H e r e</div></td> </tr> <tr> <td height="30" background="images/footer/adverticeend-footer.jpg"><div align="center" class="style1"><span class="style3">©2007 </span><span class="style5">Flash-Portal.org</span></div></td> </tr> </table></td> </tr> </table> <p> </p> </body> </html> '; ?> Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 10, 2007 Share Posted November 10, 2007 I think your needing to use OR, not AND. SELECT * FROM phpbb_users WHERE user_level = '1' OR user_level = '2'" Quote Link to comment Share on other sites More sharing options...
phpSensei Posted November 10, 2007 Author Share Posted November 10, 2007 OOO... I put IR istead of OR last time, since i did UNDO last action for everything. I wondered why, but thankyou man. it works fine... Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted November 10, 2007 Share Posted November 10, 2007 don't you need two ampersands, instead of just one - like this: && Quote Link to comment Share on other sites More sharing options...
phpSensei Posted November 10, 2007 Author Share Posted November 10, 2007 ya i know, I just wanted to show it to you guys quickly and i just coded it while posting. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 10, 2007 Share Posted November 10, 2007 don't you need two ampersands, instead of just one - like this: && With MySQL you actually type the word "AND" out. Quote Link to comment Share on other sites More sharing options...
phpSensei Posted November 10, 2007 Author Share Posted November 10, 2007 AND, or OR.... or (user_level='1') OR (user_level='2') -- right? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 10, 2007 Share Posted November 10, 2007 You don't even need the parenthesis, but yeah...that is right. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted November 10, 2007 Share Posted November 10, 2007 you can use two ampersands instead of "AND"; I just tried it on my version of mysql, but I am running version 3.23.49. You may not be able to do this on the newer versions of mysql, I am not sure about that. Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted November 10, 2007 Share Posted November 10, 2007 you can use two ampersands instead of "AND"; I just tried it on my version of mysql, but I am running version 3.23.49. You may not be able to do this on the newer versions of mysql, I am not sure about that. Ah, okay...your right. It's just not "standard" programming. 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.