BizzyD Posted November 17, 2013 Share Posted November 17, 2013 Hello, I got an issue with with php + mysql. I am trying to make a page where it shows the online admins. But right now, it selects all the users. How do I change it so it only chooses players that has AdminLevel set to 1 or higher? Code. <?php session_start(); $con=mysqli_connect("localhost","root","DELETED","DELETED"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } $result = mysqli_query($con,"SELECT * FROM playerdata"); while($row = mysqli_fetch_array($result)) { echo $row['username'] . " " . $row['online_ig']; echo "<br>"; } mysqli_close($con); ?> Quote Link to comment https://forums.phpfreaks.com/topic/283982-only-select-admins/ Share on other sites More sharing options...
requinix Posted November 17, 2013 Share Posted November 17, 2013 Put that restriction into your query. Quote Link to comment https://forums.phpfreaks.com/topic/283982-only-select-admins/#findComment-1458632 Share on other sites More sharing options...
BizzyD Posted November 17, 2013 Author Share Posted November 17, 2013 I did this: $result = mysqli_query($con,"SELECT * FROM playerdata WHERE AdminLevel = '6'"); That did not work Quote Link to comment https://forums.phpfreaks.com/topic/283982-only-select-admins/#findComment-1458633 Share on other sites More sharing options...
requinix Posted November 17, 2013 Share Posted November 17, 2013 Well duh, "AdminLevel = 6" is very different from the "AdminLevel set to 1 or higher" you said you wanted. Quote Link to comment https://forums.phpfreaks.com/topic/283982-only-select-admins/#findComment-1458634 Share on other sites More sharing options...
Irate Posted November 17, 2013 Share Posted November 17, 2013 WHERE AdminLevel >= 1 should do the job perfectly fine. Quote Link to comment https://forums.phpfreaks.com/topic/283982-only-select-admins/#findComment-1458655 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.