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> '; ?> Link to comment https://forums.phpfreaks.com/topic/76789-solved-mysql-and/ 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'" Link to comment https://forums.phpfreaks.com/topic/76789-solved-mysql-and/#findComment-388762 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... Link to comment https://forums.phpfreaks.com/topic/76789-solved-mysql-and/#findComment-388763 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: && Link to comment https://forums.phpfreaks.com/topic/76789-solved-mysql-and/#findComment-388764 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. Link to comment https://forums.phpfreaks.com/topic/76789-solved-mysql-and/#findComment-388768 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. Link to comment https://forums.phpfreaks.com/topic/76789-solved-mysql-and/#findComment-388772 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? Link to comment https://forums.phpfreaks.com/topic/76789-solved-mysql-and/#findComment-388778 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. Link to comment https://forums.phpfreaks.com/topic/76789-solved-mysql-and/#findComment-388781 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. Link to comment https://forums.phpfreaks.com/topic/76789-solved-mysql-and/#findComment-388790 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. Link to comment https://forums.phpfreaks.com/topic/76789-solved-mysql-and/#findComment-388792 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.