I'm creating a site in PHP that lists the userbars of a forum, and have a column named 'isOfficial' - I've been able to select both NULL and IS NOT NULL seperately but am not sure how to select both.
As best as I can describe it, I'd like to be able to run these both from the same table:
First Query:
<?php include_once("assets/php/db.php");
$sql = "SELECT ubFilename, ubGroupName, ubGroupOwner, ubOwnerLink, isOfficial, isActiveGroup FROM UBSUserbars WHERE NOT (isOfficial <=> NULL) ORDER BY ubGroupName";
$resultset = mysqli_query($conn, $sql);
while( $record = mysqli_fetch_assoc($resultset) ) {
?>
Second Query:
<?php include_once("assets/php/db.php");
$sql = "SELECT ubFilename, ubGroupName, ubGroupOwner, ubOwnerLink, isOfficial, isActiveGroup FROM UBSUserbars WHERE (isOfficial <=> NULL) ORDER BY ubGroupName";
$resultset = mysqli_query($conn, $sql);
while( $record = mysqli_fetch_assoc($resultset) ) {
?>
And have them both output separately as such on the same page:
<div class="cards">
<?php
include_once("assets/php/db.php");
$sql = "SELECT ubFilename, ubGroupName, ubGroupOwner, ubOwnerLink, isOfficial, isActiveGroup FROM UBSUserbars WHERE NOT (isOfficial <=> NULL) ORDER BY ubGroupName";
$resultset = mysqli_query($conn, $sql);
while( $record = mysqli_fetch_assoc($resultset) ) {
?>
<div class="col-sm-4 col-card <?php echo $record['isActiveGroup'] === 'active' ? 'active-group' : ''; ?>">
<img src="i/OGUsers/<?php echo $record['ubFilename']; ?>">
<hr>
<h4 class="group"><?php echo $record['ubGroupName']; ?></h4>
<span>Owner: <a class="owner" href="<?php echo $record['ubOwnerLink']; ?>"><?php echo $record['ubGroupOwner']; ?></a></span>
</div>
<?php } ?>